3 #define PY_SSIZE_T_CLEAN
6 #error Python headers needed to compile C extensions, please install development version of Python.
7 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
8 #error Cython requires Python 2.6+ or Python 3.3+.
10 #define CYTHON_ABI "0_29_21"
11 #define CYTHON_HEX_VERSION 0x001D15F0
12 #define CYTHON_FUTURE_DIVISION 0
15 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
17 #if !defined(WIN32) && !defined(MS_WINDOWS)
29 #define DL_IMPORT(t) t
32 #define DL_EXPORT(t) t
35 #ifndef HAVE_LONG_LONG
36 #if PY_VERSION_HEX >= 0x02070000
37 #define HAVE_LONG_LONG
41 #define PY_LONG_LONG LONG_LONG
44 #define Py_HUGE_VAL HUGE_VAL
47 #define CYTHON_COMPILING_IN_PYPY 1
48 #define CYTHON_COMPILING_IN_PYSTON 0
49 #define CYTHON_COMPILING_IN_CPYTHON 0
50 #undef CYTHON_USE_TYPE_SLOTS
51 #define CYTHON_USE_TYPE_SLOTS 0
52 #undef CYTHON_USE_PYTYPE_LOOKUP
53 #define CYTHON_USE_PYTYPE_LOOKUP 0
54 #if PY_VERSION_HEX < 0x03050000
55 #undef CYTHON_USE_ASYNC_SLOTS
56 #define CYTHON_USE_ASYNC_SLOTS 0
57 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
58 #define CYTHON_USE_ASYNC_SLOTS 1
60 #undef CYTHON_USE_PYLIST_INTERNALS
61 #define CYTHON_USE_PYLIST_INTERNALS 0
62 #undef CYTHON_USE_UNICODE_INTERNALS
63 #define CYTHON_USE_UNICODE_INTERNALS 0
64 #undef CYTHON_USE_UNICODE_WRITER
65 #define CYTHON_USE_UNICODE_WRITER 0
66 #undef CYTHON_USE_PYLONG_INTERNALS
67 #define CYTHON_USE_PYLONG_INTERNALS 0
68 #undef CYTHON_AVOID_BORROWED_REFS
69 #define CYTHON_AVOID_BORROWED_REFS 1
70 #undef CYTHON_ASSUME_SAFE_MACROS
71 #define CYTHON_ASSUME_SAFE_MACROS 0
72 #undef CYTHON_UNPACK_METHODS
73 #define CYTHON_UNPACK_METHODS 0
74 #undef CYTHON_FAST_THREAD_STATE
75 #define CYTHON_FAST_THREAD_STATE 0
76 #undef CYTHON_FAST_PYCALL
77 #define CYTHON_FAST_PYCALL 0
78 #undef CYTHON_PEP489_MULTI_PHASE_INIT
79 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
80 #undef CYTHON_USE_TP_FINALIZE
81 #define CYTHON_USE_TP_FINALIZE 0
82 #undef CYTHON_USE_DICT_VERSIONS
83 #define CYTHON_USE_DICT_VERSIONS 0
84 #undef CYTHON_USE_EXC_INFO_STACK
85 #define CYTHON_USE_EXC_INFO_STACK 0
86 #elif defined(PYSTON_VERSION)
87 #define CYTHON_COMPILING_IN_PYPY 0
88 #define CYTHON_COMPILING_IN_PYSTON 1
89 #define CYTHON_COMPILING_IN_CPYTHON 0
90 #ifndef CYTHON_USE_TYPE_SLOTS
91 #define CYTHON_USE_TYPE_SLOTS 1
93 #undef CYTHON_USE_PYTYPE_LOOKUP
94 #define CYTHON_USE_PYTYPE_LOOKUP 0
95 #undef CYTHON_USE_ASYNC_SLOTS
96 #define CYTHON_USE_ASYNC_SLOTS 0
97 #undef CYTHON_USE_PYLIST_INTERNALS
98 #define CYTHON_USE_PYLIST_INTERNALS 0
99 #ifndef CYTHON_USE_UNICODE_INTERNALS
100 #define CYTHON_USE_UNICODE_INTERNALS 1
102 #undef CYTHON_USE_UNICODE_WRITER
103 #define CYTHON_USE_UNICODE_WRITER 0
104 #undef CYTHON_USE_PYLONG_INTERNALS
105 #define CYTHON_USE_PYLONG_INTERNALS 0
106 #ifndef CYTHON_AVOID_BORROWED_REFS
107 #define CYTHON_AVOID_BORROWED_REFS 0
109 #ifndef CYTHON_ASSUME_SAFE_MACROS
110 #define CYTHON_ASSUME_SAFE_MACROS 1
112 #ifndef CYTHON_UNPACK_METHODS
113 #define CYTHON_UNPACK_METHODS 1
115 #undef CYTHON_FAST_THREAD_STATE
116 #define CYTHON_FAST_THREAD_STATE 0
117 #undef CYTHON_FAST_PYCALL
118 #define CYTHON_FAST_PYCALL 0
119 #undef CYTHON_PEP489_MULTI_PHASE_INIT
120 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
121 #undef CYTHON_USE_TP_FINALIZE
122 #define CYTHON_USE_TP_FINALIZE 0
123 #undef CYTHON_USE_DICT_VERSIONS
124 #define CYTHON_USE_DICT_VERSIONS 0
125 #undef CYTHON_USE_EXC_INFO_STACK
126 #define CYTHON_USE_EXC_INFO_STACK 0
128 #define CYTHON_COMPILING_IN_PYPY 0
129 #define CYTHON_COMPILING_IN_PYSTON 0
130 #define CYTHON_COMPILING_IN_CPYTHON 1
131 #ifndef CYTHON_USE_TYPE_SLOTS
132 #define CYTHON_USE_TYPE_SLOTS 1
134 #if PY_VERSION_HEX < 0x02070000
135 #undef CYTHON_USE_PYTYPE_LOOKUP
136 #define CYTHON_USE_PYTYPE_LOOKUP 0
137 #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
138 #define CYTHON_USE_PYTYPE_LOOKUP 1
140 #if PY_MAJOR_VERSION < 3
141 #undef CYTHON_USE_ASYNC_SLOTS
142 #define CYTHON_USE_ASYNC_SLOTS 0
143 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
144 #define CYTHON_USE_ASYNC_SLOTS 1
146 #if PY_VERSION_HEX < 0x02070000
147 #undef CYTHON_USE_PYLONG_INTERNALS
148 #define CYTHON_USE_PYLONG_INTERNALS 0
149 #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
150 #define CYTHON_USE_PYLONG_INTERNALS 1
152 #ifndef CYTHON_USE_PYLIST_INTERNALS
153 #define CYTHON_USE_PYLIST_INTERNALS 1
155 #ifndef CYTHON_USE_UNICODE_INTERNALS
156 #define CYTHON_USE_UNICODE_INTERNALS 1
158 #if PY_VERSION_HEX < 0x030300F0
159 #undef CYTHON_USE_UNICODE_WRITER
160 #define CYTHON_USE_UNICODE_WRITER 0
161 #elif !defined(CYTHON_USE_UNICODE_WRITER)
162 #define CYTHON_USE_UNICODE_WRITER 1
164 #ifndef CYTHON_AVOID_BORROWED_REFS
165 #define CYTHON_AVOID_BORROWED_REFS 0
167 #ifndef CYTHON_ASSUME_SAFE_MACROS
168 #define CYTHON_ASSUME_SAFE_MACROS 1
170 #ifndef CYTHON_UNPACK_METHODS
171 #define CYTHON_UNPACK_METHODS 1
173 #ifndef CYTHON_FAST_THREAD_STATE
174 #define CYTHON_FAST_THREAD_STATE 1
176 #ifndef CYTHON_FAST_PYCALL
177 #define CYTHON_FAST_PYCALL 1
179 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
180 #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
182 #ifndef CYTHON_USE_TP_FINALIZE
183 #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
185 #ifndef CYTHON_USE_DICT_VERSIONS
186 #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
188 #ifndef CYTHON_USE_EXC_INFO_STACK
189 #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
192 #if !defined(CYTHON_FAST_PYCCALL)
193 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
195 #if CYTHON_USE_PYLONG_INTERNALS
196 #include "longintrepr.h"
201 enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P ==
sizeof(
void*)) };
204 #ifndef __has_attribute
205 #define __has_attribute(x) 0
207 #ifndef __has_cpp_attribute
208 #define __has_cpp_attribute(x) 0
210 #ifndef CYTHON_RESTRICT
211 #if defined(__GNUC__)
212 #define CYTHON_RESTRICT __restrict__
213 #elif defined(_MSC_VER) && _MSC_VER >= 1400
214 #define CYTHON_RESTRICT __restrict
215 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
216 #define CYTHON_RESTRICT restrict
218 #define CYTHON_RESTRICT
221 #ifndef CYTHON_UNUSED
222 # if defined(__GNUC__)
223 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
224 # define CYTHON_UNUSED __attribute__ ((__unused__))
226 # define CYTHON_UNUSED
228 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
229 # define CYTHON_UNUSED __attribute__ ((__unused__))
231 # define CYTHON_UNUSED
234 #ifndef CYTHON_MAYBE_UNUSED_VAR
235 # if defined(__cplusplus)
236 template<
class T>
void CYTHON_MAYBE_UNUSED_VAR(
const T& ) { }
238 # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
241 #ifndef CYTHON_NCP_UNUSED
242 # if CYTHON_COMPILING_IN_CPYTHON
243 # define CYTHON_NCP_UNUSED
245 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
248 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
250 #ifndef _MSC_STDINT_H_
252 typedef unsigned char uint8_t;
253 typedef unsigned int uint32_t;
255 typedef unsigned __int8 uint8_t;
256 typedef unsigned __int32 uint32_t;
262 #ifndef CYTHON_FALLTHROUGH
263 #if defined(__cplusplus) && __cplusplus >= 201103L
264 #if __has_cpp_attribute(fallthrough)
265 #define CYTHON_FALLTHROUGH [[fallthrough]]
266 #elif __has_cpp_attribute(clang::fallthrough)
267 #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
268 #elif __has_cpp_attribute(gnu::fallthrough)
269 #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
272 #ifndef CYTHON_FALLTHROUGH
273 #if __has_attribute(fallthrough)
274 #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
276 #define CYTHON_FALLTHROUGH
279 #if defined(__clang__ ) && defined(__apple_build_version__)
280 #if __apple_build_version__ < 7000000
281 #undef CYTHON_FALLTHROUGH
282 #define CYTHON_FALLTHROUGH
287 #ifndef CYTHON_INLINE
288 #if defined(__clang__)
289 #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
290 #elif defined(__GNUC__)
291 #define CYTHON_INLINE __inline__
292 #elif defined(_MSC_VER)
293 #define CYTHON_INLINE __inline
294 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
295 #define CYTHON_INLINE inline
297 #define CYTHON_INLINE
301 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
302 #define Py_OptimizeFlag 0
304 #define __PYX_BUILD_PY_SSIZE_T "n"
305 #define CYTHON_FORMAT_SSIZE_T "z"
306 #if PY_MAJOR_VERSION < 3
307 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
308 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
309 PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
310 #define __Pyx_DefaultClassType PyClass_Type
312 #define __Pyx_BUILTIN_MODULE_NAME "builtins"
313 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
314 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
315 PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
317 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
318 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
320 #define __Pyx_DefaultClassType PyType_Type
322 #ifndef Py_TPFLAGS_CHECKTYPES
323 #define Py_TPFLAGS_CHECKTYPES 0
325 #ifndef Py_TPFLAGS_HAVE_INDEX
326 #define Py_TPFLAGS_HAVE_INDEX 0
328 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
329 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
331 #ifndef Py_TPFLAGS_HAVE_FINALIZE
332 #define Py_TPFLAGS_HAVE_FINALIZE 0
334 #ifndef METH_STACKLESS
335 #define METH_STACKLESS 0
337 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
338 #ifndef METH_FASTCALL
339 #define METH_FASTCALL 0x80
341 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *
self, PyObject *
const *args, Py_ssize_t nargs);
342 typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *
self, PyObject *
const *args,
343 Py_ssize_t nargs, PyObject *kwnames);
345 #define __Pyx_PyCFunctionFast _PyCFunctionFast
346 #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
348 #if CYTHON_FAST_PYCCALL
349 #define __Pyx_PyFastCFunction_Check(func)\
350 ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
352 #define __Pyx_PyFastCFunction_Check(func) 0
354 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
355 #define PyObject_Malloc(s) PyMem_Malloc(s)
356 #define PyObject_Free(p) PyMem_Free(p)
357 #define PyObject_Realloc(p) PyMem_Realloc(p)
359 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
360 #define PyMem_RawMalloc(n) PyMem_Malloc(n)
361 #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
362 #define PyMem_RawFree(p) PyMem_Free(p)
364 #if CYTHON_COMPILING_IN_PYSTON
365 #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
366 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
368 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
369 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
371 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
372 #define __Pyx_PyThreadState_Current PyThreadState_GET()
373 #elif PY_VERSION_HEX >= 0x03060000
374 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
375 #elif PY_VERSION_HEX >= 0x03000000
376 #define __Pyx_PyThreadState_Current PyThreadState_GET()
378 #define __Pyx_PyThreadState_Current _PyThreadState_Current
380 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
381 #include "pythread.h"
382 #define Py_tss_NEEDS_INIT 0
383 typedef int Py_tss_t;
384 static CYTHON_INLINE
int PyThread_tss_create(Py_tss_t *key) {
385 *key = PyThread_create_key();
388 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(
void) {
389 Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(
sizeof(Py_tss_t));
390 *key = Py_tss_NEEDS_INIT;
393 static CYTHON_INLINE
void PyThread_tss_free(Py_tss_t *key) {
396 static CYTHON_INLINE
int PyThread_tss_is_created(Py_tss_t *key) {
397 return *key != Py_tss_NEEDS_INIT;
399 static CYTHON_INLINE
void PyThread_tss_delete(Py_tss_t *key) {
400 PyThread_delete_key(*key);
401 *key = Py_tss_NEEDS_INIT;
403 static CYTHON_INLINE
int PyThread_tss_set(Py_tss_t *key,
void *value) {
404 return PyThread_set_key_value(*key, value);
406 static CYTHON_INLINE
void * PyThread_tss_get(Py_tss_t *key) {
407 return PyThread_get_key_value(*key);
410 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
411 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
413 #define __Pyx_PyDict_NewPresized(n) PyDict_New()
415 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
416 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
417 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
419 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
420 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
422 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
423 #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
425 #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
427 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
428 #define CYTHON_PEP393_ENABLED 1
429 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
430 0 : _PyUnicode_Ready((PyObject *)(op)))
431 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
432 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
433 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
434 #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
435 #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
436 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
437 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
438 #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
439 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
441 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
444 #define CYTHON_PEP393_ENABLED 0
445 #define PyUnicode_1BYTE_KIND 1
446 #define PyUnicode_2BYTE_KIND 2
447 #define PyUnicode_4BYTE_KIND 4
448 #define __Pyx_PyUnicode_READY(op) (0)
449 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
450 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
451 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
452 #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
453 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
454 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
455 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
456 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
458 #if CYTHON_COMPILING_IN_PYPY
459 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
460 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
462 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
463 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
464 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
466 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
467 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
469 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
470 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
472 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
473 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
475 #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
476 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
477 #if PY_MAJOR_VERSION >= 3
478 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
480 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
482 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
483 #define PyObject_ASCII(o) PyObject_Repr(o)
485 #if PY_MAJOR_VERSION >= 3
486 #define PyBaseString_Type PyUnicode_Type
487 #define PyStringObject PyUnicodeObject
488 #define PyString_Type PyUnicode_Type
489 #define PyString_Check PyUnicode_Check
490 #define PyString_CheckExact PyUnicode_CheckExact
491 #ifndef PyObject_Unicode
492 #define PyObject_Unicode PyObject_Str
495 #if PY_MAJOR_VERSION >= 3
496 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
497 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
499 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
500 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
502 #ifndef PySet_CheckExact
503 #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
505 #if PY_VERSION_HEX >= 0x030900A4
506 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
507 #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
509 #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
510 #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
512 #if CYTHON_ASSUME_SAFE_MACROS
513 #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
515 #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
517 #if PY_MAJOR_VERSION >= 3
518 #define PyIntObject PyLongObject
519 #define PyInt_Type PyLong_Type
520 #define PyInt_Check(op) PyLong_Check(op)
521 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
522 #define PyInt_FromString PyLong_FromString
523 #define PyInt_FromUnicode PyLong_FromUnicode
524 #define PyInt_FromLong PyLong_FromLong
525 #define PyInt_FromSize_t PyLong_FromSize_t
526 #define PyInt_FromSsize_t PyLong_FromSsize_t
527 #define PyInt_AsLong PyLong_AsLong
528 #define PyInt_AS_LONG PyLong_AS_LONG
529 #define PyInt_AsSsize_t PyLong_AsSsize_t
530 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
531 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
532 #define PyNumber_Int PyNumber_Long
534 #if PY_MAJOR_VERSION >= 3
535 #define PyBoolObject PyLongObject
537 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
538 #ifndef PyUnicode_InternFromString
539 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
542 #if PY_VERSION_HEX < 0x030200A4
543 typedef long Py_hash_t;
544 #define __Pyx_PyInt_FromHash_t PyInt_FromLong
545 #define __Pyx_PyInt_AsHash_t PyInt_AsLong
547 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
548 #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
550 #if PY_MAJOR_VERSION >= 3
551 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
553 #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
555 #if CYTHON_USE_ASYNC_SLOTS
556 #if PY_VERSION_HEX >= 0x030500B1
557 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
558 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
560 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
563 #define __Pyx_PyType_AsAsync(obj) NULL
565 #ifndef __Pyx_PyAsyncMethodsStruct
570 } __Pyx_PyAsyncMethodsStruct;
573 #if defined(WIN32) || defined(MS_WINDOWS)
574 #define _USE_MATH_DEFINES
578 #define __PYX_NAN() ((float) NAN)
580 static CYTHON_INLINE
float __PYX_NAN() {
582 memset(&value, 0xFF,
sizeof(value));
586 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
587 #define __Pyx_truncl trunc
589 #define __Pyx_truncl truncl
592 #define __PYX_MARK_ERR_POS(f_index, lineno) \
593 { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
594 #define __PYX_ERR(f_index, lineno, Ln_error) \
595 { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
597 #ifndef __PYX_EXTERN_C
599 #define __PYX_EXTERN_C extern "C"
601 #define __PYX_EXTERN_C extern
605 #define __PYX_HAVE__superluWrappers
606 #define __PYX_HAVE_API__superluWrappers
610 #include "numpy/arrayobject.h"
611 #include "numpy/ufuncobject.h"
617 #include "pythread.h"
623 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
624 #define CYTHON_WITHOUT_ASSERTIONS
627 typedef struct {PyObject **p;
const char *
s;
const Py_ssize_t
n;
const char* encoding;
628 const char is_unicode;
const char is_str;
const char intern; } __Pyx_StringTabEntry;
630 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
631 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
632 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
633 #define __PYX_DEFAULT_STRING_ENCODING ""
634 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
635 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
636 #define __Pyx_uchar_cast(c) ((unsigned char)c)
637 #define __Pyx_long_cast(x) ((long)x)
638 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
639 (sizeof(type) < sizeof(Py_ssize_t)) ||\
640 (sizeof(type) > sizeof(Py_ssize_t) &&\
641 likely(v < (type)PY_SSIZE_T_MAX ||\
642 v == (type)PY_SSIZE_T_MAX) &&\
643 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
644 v == (type)PY_SSIZE_T_MIN))) ||\
645 (sizeof(type) == sizeof(Py_ssize_t) &&\
646 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
647 v == (type)PY_SSIZE_T_MAX))) )
648 static CYTHON_INLINE
int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
649 return (
size_t) i < (size_t) limit;
651 #if defined (__cplusplus) && __cplusplus >= 201103L
653 #define __Pyx_sst_abs(value) std::abs(value)
654 #elif SIZEOF_INT >= SIZEOF_SIZE_T
655 #define __Pyx_sst_abs(value) abs(value)
656 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
657 #define __Pyx_sst_abs(value) labs(value)
658 #elif defined (_MSC_VER)
659 #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
660 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
661 #define __Pyx_sst_abs(value) llabs(value)
662 #elif defined (__GNUC__)
663 #define __Pyx_sst_abs(value) __builtin_llabs(value)
665 #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
667 static CYTHON_INLINE
const char* __Pyx_PyObject_AsString(PyObject*);
668 static CYTHON_INLINE
const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
669 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
670 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
671 #define __Pyx_PyBytes_FromString PyBytes_FromString
672 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
673 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(
const char*);
674 #if PY_MAJOR_VERSION < 3
675 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
676 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
678 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
679 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
681 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
682 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
683 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
684 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
685 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
686 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
687 #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
688 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
689 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
690 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
691 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
692 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
693 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
694 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
695 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
696 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
697 static CYTHON_INLINE
size_t __Pyx_Py_UNICODE_strlen(
const Py_UNICODE *
u) {
698 const Py_UNICODE *u_end =
u;
700 return (
size_t)(u_end -
u - 1);
702 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
703 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
704 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
705 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
706 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
707 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(
long b);
708 static CYTHON_INLINE
int __Pyx_PyObject_IsTrue(PyObject*);
709 static CYTHON_INLINE
int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
710 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
711 #define __Pyx_PySequence_Tuple(obj)\
712 (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
713 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
714 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(
size_t);
715 #if CYTHON_ASSUME_SAFE_MACROS
716 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
718 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
720 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
721 #if PY_MAJOR_VERSION >= 3
722 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
724 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
726 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
727 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
728 static int __Pyx_sys_getdefaultencoding_not_ascii;
729 static int __Pyx_init_sys_getdefaultencoding_params(
void) {
731 PyObject* default_encoding = NULL;
732 PyObject* ascii_chars_u = NULL;
733 PyObject* ascii_chars_b = NULL;
734 const char* default_encoding_c;
735 sys = PyImport_ImportModule(
"sys");
737 default_encoding = PyObject_CallMethod(sys, (
char*)
"getdefaultencoding", NULL);
739 if (!default_encoding)
goto bad;
740 default_encoding_c = PyBytes_AsString(default_encoding);
741 if (!default_encoding_c)
goto bad;
742 if (strcmp(default_encoding_c,
"ascii") == 0) {
743 __Pyx_sys_getdefaultencoding_not_ascii = 0;
745 char ascii_chars[128];
747 for (
c = 0;
c < 128;
c++) {
750 __Pyx_sys_getdefaultencoding_not_ascii = 1;
751 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
752 if (!ascii_chars_u)
goto bad;
753 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
754 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
757 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
761 Py_DECREF(ascii_chars_u);
762 Py_DECREF(ascii_chars_b);
764 Py_DECREF(default_encoding);
767 Py_XDECREF(default_encoding);
768 Py_XDECREF(ascii_chars_u);
769 Py_XDECREF(ascii_chars_b);
773 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
774 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
776 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
777 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
778 static char* __PYX_DEFAULT_STRING_ENCODING;
779 static int __Pyx_init_sys_getdefaultencoding_params(
void) {
781 PyObject* default_encoding = NULL;
782 char* default_encoding_c;
783 sys = PyImport_ImportModule(
"sys");
785 default_encoding = PyObject_CallMethod(sys, (
char*) (
const char*)
"getdefaultencoding", NULL);
787 if (!default_encoding)
goto bad;
788 default_encoding_c = PyBytes_AsString(default_encoding);
789 if (!default_encoding_c)
goto bad;
790 __PYX_DEFAULT_STRING_ENCODING = (
char*) malloc(strlen(default_encoding_c) + 1);
791 if (!__PYX_DEFAULT_STRING_ENCODING)
goto bad;
792 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
793 Py_DECREF(default_encoding);
796 Py_XDECREF(default_encoding);
804 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
805 #define likely(x) __builtin_expect(!!(x), 1)
806 #define unlikely(x) __builtin_expect(!!(x), 0)
808 #define likely(x) (x)
809 #define unlikely(x) (x)
811 static CYTHON_INLINE
void __Pyx_pretend_to_initialize(
void* ptr) { (void)ptr; }
813 static PyObject *__pyx_m = NULL;
814 static PyObject *__pyx_d;
815 static PyObject *__pyx_b;
816 static PyObject *__pyx_cython_runtime = NULL;
817 static PyObject *__pyx_empty_tuple;
818 static PyObject *__pyx_empty_bytes;
819 static PyObject *__pyx_empty_unicode;
820 static int __pyx_lineno;
821 static int __pyx_clineno = 0;
822 static const char * __pyx_cfilenm= __FILE__;
823 static const char *__pyx_filename;
826 #if !defined(CYTHON_CCOMPLEX)
827 #if defined(__cplusplus)
828 #define CYTHON_CCOMPLEX 1
829 #elif defined(_Complex_I)
830 #define CYTHON_CCOMPLEX 1
832 #define CYTHON_CCOMPLEX 0
842 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
844 #define _Complex_I 1.0fj
848 static const char *__pyx_f[] = {
849 "proteus/superluWrappers.pyx",
855 struct __pyx_memoryview_obj;
857 struct __pyx_memoryview_obj *memview;
860 Py_ssize_t strides[8];
861 Py_ssize_t suboffsets[8];
862 } __Pyx_memviewslice;
863 #define __Pyx_MemoryView_Len(m) (m.shape[0])
866 #include <pythread.h>
867 #ifndef CYTHON_ATOMICS
868 #define CYTHON_ATOMICS 1
870 #define __pyx_atomic_int_type int
871 #if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 ||\
872 (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL >= 2)) &&\
874 #define __pyx_atomic_incr_aligned(value, lock) __sync_fetch_and_add(value, 1)
875 #define __pyx_atomic_decr_aligned(value, lock) __sync_fetch_and_sub(value, 1)
876 #ifdef __PYX_DEBUG_ATOMICS
877 #warning "Using GNU atomics"
879 #elif CYTHON_ATOMICS && defined(_MSC_VER) && 0
881 #undef __pyx_atomic_int_type
882 #define __pyx_atomic_int_type LONG
883 #define __pyx_atomic_incr_aligned(value, lock) InterlockedIncrement(value)
884 #define __pyx_atomic_decr_aligned(value, lock) InterlockedDecrement(value)
885 #ifdef __PYX_DEBUG_ATOMICS
886 #pragma message ("Using MSVC atomics")
888 #elif CYTHON_ATOMICS && (defined(__ICC) || defined(__INTEL_COMPILER)) && 0
889 #define __pyx_atomic_incr_aligned(value, lock) _InterlockedIncrement(value)
890 #define __pyx_atomic_decr_aligned(value, lock) _InterlockedDecrement(value)
891 #ifdef __PYX_DEBUG_ATOMICS
892 #warning "Using Intel atomics"
895 #undef CYTHON_ATOMICS
896 #define CYTHON_ATOMICS 0
897 #ifdef __PYX_DEBUG_ATOMICS
898 #warning "Not using atomics"
901 typedef volatile __pyx_atomic_int_type __pyx_atomic_int;
903 #define __pyx_add_acquisition_count(memview)\
904 __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
905 #define __pyx_sub_acquisition_count(memview)\
906 __pyx_atomic_decr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
908 #define __pyx_add_acquisition_count(memview)\
909 __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
910 #define __pyx_sub_acquisition_count(memview)\
911 __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
915 #ifndef __PYX_FORCE_INIT_THREADS
916 #define __PYX_FORCE_INIT_THREADS 0
920 #define __Pyx_PyGILState_Ensure PyGILState_Ensure
921 #define __Pyx_PyGILState_Release PyGILState_Release
922 #define __Pyx_FastGIL_Remember()
923 #define __Pyx_FastGIL_Forget()
924 #define __Pyx_FastGilFuncInit()
927 #define IS_UNSIGNED(type) (((type) -1) > 0)
928 struct __Pyx_StructField_;
929 #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
932 struct __Pyx_StructField_* fields;
940 typedef struct __Pyx_StructField_ {
941 __Pyx_TypeInfo* type;
946 __Pyx_StructField* field;
947 size_t parent_offset;
948 } __Pyx_BufFmt_StackElem;
950 __Pyx_StructField root;
951 __Pyx_BufFmt_StackElem* head;
953 size_t new_count, enc_count;
954 size_t struct_alignment;
960 } __Pyx_BufFmt_Context;
970 typedef npy_int8 __pyx_t_5numpy_int8_t;
979 typedef npy_int16 __pyx_t_5numpy_int16_t;
988 typedef npy_int32 __pyx_t_5numpy_int32_t;
997 typedef npy_int64 __pyx_t_5numpy_int64_t;
1006 typedef npy_uint8 __pyx_t_5numpy_uint8_t;
1015 typedef npy_uint16 __pyx_t_5numpy_uint16_t;
1024 typedef npy_uint32 __pyx_t_5numpy_uint32_t;
1033 typedef npy_uint64 __pyx_t_5numpy_uint64_t;
1042 typedef npy_float32 __pyx_t_5numpy_float32_t;
1051 typedef npy_float64 __pyx_t_5numpy_float64_t;
1060 typedef npy_long __pyx_t_5numpy_int_t;
1069 typedef npy_longlong __pyx_t_5numpy_long_t;
1078 typedef npy_longlong __pyx_t_5numpy_longlong_t;
1087 typedef npy_ulong __pyx_t_5numpy_uint_t;
1096 typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
1105 typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
1114 typedef npy_intp __pyx_t_5numpy_intp_t;
1123 typedef npy_uintp __pyx_t_5numpy_uintp_t;
1132 typedef npy_double __pyx_t_5numpy_float_t;
1141 typedef npy_double __pyx_t_5numpy_double_t;
1150 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
1154 typedef ::std::complex< float > __pyx_t_float_complex;
1156 typedef float _Complex __pyx_t_float_complex;
1159 typedef struct {
float real, imag; } __pyx_t_float_complex;
1161 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float,
float);
1166 typedef ::std::complex< double > __pyx_t_double_complex;
1168 typedef double _Complex __pyx_t_double_complex;
1171 typedef struct {
double real, imag; } __pyx_t_double_complex;
1173 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double,
double);
1177 struct __pyx_obj_15superluWrappers_cSparseMatrix;
1178 struct __pyx_obj_15superluWrappers_SparseFactor;
1179 struct __pyx_array_obj;
1180 struct __pyx_MemviewEnum_obj;
1181 struct __pyx_memoryview_obj;
1182 struct __pyx_memoryviewslice_obj;
1191 typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
1200 typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
1209 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
1218 typedef npy_cdouble __pyx_t_5numpy_complex_t;
1219 struct __pyx_t_15superluWrappers__NRformat;
1220 struct __pyx_t_15superluWrappers__NCformat;
1221 struct __pyx_t_15superluWrappers__DNformat;
1222 struct __pyx_t_15superluWrappers__NCPformat;
1231 struct __pyx_t_15superluWrappers__NRformat {
1232 __pyx_t_5numpy_int32_t
nnz;
1233 __pyx_t_5numpy_float64_t *nzval;
1234 __pyx_t_5numpy_int32_t *colind;
1235 __pyx_t_5numpy_int32_t *rowptr;
1245 struct __pyx_t_15superluWrappers__NCformat {
1246 __pyx_t_5numpy_int32_t
nnz;
1247 __pyx_t_5numpy_float64_t *nzval;
1248 __pyx_t_5numpy_int32_t *rowind;
1249 __pyx_t_5numpy_int32_t *colptr;
1259 struct __pyx_t_15superluWrappers__DNformat {
1260 __pyx_t_5numpy_int32_t lda;
1271 struct __pyx_t_15superluWrappers__NCPformat {
1272 __pyx_t_5numpy_int32_t
nnz;
1274 __pyx_t_5numpy_int32_t *rowind;
1275 __pyx_t_5numpy_int32_t *colbeg;
1276 __pyx_t_5numpy_int32_t *colend;
1286 struct __pyx_obj_15superluWrappers_cSparseMatrix {
1288 __pyx_t_5numpy_int32_t dim[2];
1289 struct __pyx_t_15superluWrappers__NRformat A;
1300 struct __pyx_obj_15superluWrappers_SparseFactor {
1302 struct __pyx_vtabstruct_15superluWrappers_SparseFactor *__pyx_vtab;
1303 superlu_options_t options;
1311 struct __pyx_t_15superluWrappers__NCformat storeA;
1312 struct __pyx_t_15superluWrappers__DNformat storeX;
1316 unsigned int use_same_perm_c;
1317 unsigned int use_same_sparsity;
1329 struct __pyx_array_obj {
1331 struct __pyx_vtabstruct_array *__pyx_vtab;
1337 Py_ssize_t *_strides;
1338 Py_ssize_t itemsize;
1341 void (*callback_free_data)(
void *);
1343 int dtype_is_object;
1354 struct __pyx_MemviewEnum_obj {
1367 struct __pyx_memoryview_obj {
1369 struct __pyx_vtabstruct_memoryview *__pyx_vtab;
1372 PyObject *_array_interface;
1373 PyThread_type_lock lock;
1374 __pyx_atomic_int acquisition_count[2];
1375 __pyx_atomic_int *acquisition_count_aligned_p;
1378 int dtype_is_object;
1379 __Pyx_TypeInfo *typeinfo;
1390 struct __pyx_memoryviewslice_obj {
1391 struct __pyx_memoryview_obj __pyx_base;
1392 __Pyx_memviewslice from_slice;
1393 PyObject *from_object;
1394 PyObject *(*to_object_func)(
char *);
1395 int (*to_dtype_func)(
char *, PyObject *);
1408 struct __pyx_vtabstruct_15superluWrappers_SparseFactor {
1409 PyObject *(*_set_mat_types)(
struct __pyx_obj_15superluWrappers_SparseFactor *);
1411 static struct __pyx_vtabstruct_15superluWrappers_SparseFactor *__pyx_vtabptr_15superluWrappers_SparseFactor;
1422 struct __pyx_vtabstruct_array {
1423 PyObject *(*get_memview)(
struct __pyx_array_obj *);
1425 static struct __pyx_vtabstruct_array *__pyx_vtabptr_array;
1436 struct __pyx_vtabstruct_memoryview {
1437 char *(*get_item_pointer)(
struct __pyx_memoryview_obj *, PyObject *);
1438 PyObject *(*is_slice)(
struct __pyx_memoryview_obj *, PyObject *);
1439 PyObject *(*setitem_slice_assignment)(
struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1440 PyObject *(*setitem_slice_assign_scalar)(
struct __pyx_memoryview_obj *,
struct __pyx_memoryview_obj *, PyObject *);
1441 PyObject *(*setitem_indexed)(
struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1442 PyObject *(*convert_item_to_object)(
struct __pyx_memoryview_obj *,
char *);
1443 PyObject *(*assign_item_from_object)(
struct __pyx_memoryview_obj *,
char *, PyObject *);
1445 static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview;
1456 struct __pyx_vtabstruct__memoryviewslice {
1457 struct __pyx_vtabstruct_memoryview __pyx_base;
1459 static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
1463 #ifndef CYTHON_REFNANNY
1464 #define CYTHON_REFNANNY 0
1468 void (*INCREF)(
void*, PyObject*, int);
1469 void (*DECREF)(
void*, PyObject*, int);
1470 void (*GOTREF)(
void*, PyObject*, int);
1471 void (*GIVEREF)(
void*, PyObject*, int);
1472 void* (*SetupContext)(
const char*, int,
const char*);
1473 void (*FinishContext)(
void**);
1474 } __Pyx_RefNannyAPIStruct;
1475 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1476 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(
const char *modname);
1477 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1479 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1481 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1482 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1483 PyGILState_Release(__pyx_gilstate_save);\
1485 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1488 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1489 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1491 #define __Pyx_RefNannyFinishContext()\
1492 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1493 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1494 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1495 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1496 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1497 #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1498 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1499 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1500 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1502 #define __Pyx_RefNannyDeclarations
1503 #define __Pyx_RefNannySetupContext(name, acquire_gil)
1504 #define __Pyx_RefNannyFinishContext()
1505 #define __Pyx_INCREF(r) Py_INCREF(r)
1506 #define __Pyx_DECREF(r) Py_DECREF(r)
1507 #define __Pyx_GOTREF(r)
1508 #define __Pyx_GIVEREF(r)
1509 #define __Pyx_XINCREF(r) Py_XINCREF(r)
1510 #define __Pyx_XDECREF(r) Py_XDECREF(r)
1511 #define __Pyx_XGOTREF(r)
1512 #define __Pyx_XGIVEREF(r)
1514 #define __Pyx_XDECREF_SET(r, v) do {\
1515 PyObject *tmp = (PyObject *) r;\
1516 r = v; __Pyx_XDECREF(tmp);\
1518 #define __Pyx_DECREF_SET(r, v) do {\
1519 PyObject *tmp = (PyObject *) r;\
1520 r = v; __Pyx_DECREF(tmp);\
1522 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1523 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1526 #if CYTHON_USE_TYPE_SLOTS
1527 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1529 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1533 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1536 static void __Pyx_RaiseArgtupleInvalid(
const char* func_name,
int exact,
1537 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1540 static void __Pyx_RaiseDoubleKeywordsError(
const char* func_name, PyObject* kw_name);
1543 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1544 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1545 const char* function_name);
1548 #if CYTHON_USE_TYPE_SLOTS
1549 #define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL)
1550 static CYTHON_INLINE
int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value);
1552 #define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n)
1553 #define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
1557 #if CYTHON_COMPILING_IN_CPYTHON
1558 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1560 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1564 static CYTHON_INLINE
int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1567 #define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
1568 #define __Pyx_MEMVIEW_DIRECT 1
1569 #define __Pyx_MEMVIEW_PTR 2
1570 #define __Pyx_MEMVIEW_FULL 4
1571 #define __Pyx_MEMVIEW_CONTIG 8
1572 #define __Pyx_MEMVIEW_STRIDED 16
1573 #define __Pyx_MEMVIEW_FOLLOW 32
1574 #define __Pyx_IS_C_CONTIG 1
1575 #define __Pyx_IS_F_CONTIG 2
1576 static int __Pyx_init_memviewslice(
1577 struct __pyx_memoryview_obj *memview,
1579 __Pyx_memviewslice *memviewslice,
1580 int memview_is_new_reference);
1581 static CYTHON_INLINE
int __pyx_add_acquisition_count_locked(
1582 __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
1583 static CYTHON_INLINE
int __pyx_sub_acquisition_count_locked(
1584 __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
1585 #define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
1586 #define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
1587 #define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
1588 #define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__)
1589 static CYTHON_INLINE
void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *,
int,
int);
1590 static CYTHON_INLINE
void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *,
int,
int);
1593 #if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
1594 static CYTHON_INLINE PyObject* __Pyx_PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name) {
1596 PyTypeObject *tp = Py_TYPE(obj);
1597 #if PY_MAJOR_VERSION < 3
1598 if (unlikely(PyInstance_Check(obj)))
1599 return __Pyx_PyObject_GetAttrStr(obj, attr_name);
1601 res = _PyType_Lookup(tp, attr_name);
1603 descrgetfunc
f = Py_TYPE(res)->tp_descr_get;
1607 res =
f(res, obj, (PyObject *)tp);
1610 PyErr_SetObject(PyExc_AttributeError, attr_name);
1615 #define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n)
1619 #if CYTHON_FAST_PYCALL
1620 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1621 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1622 #if 1 || PY_VERSION_HEX < 0x030600B1
1623 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1625 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1627 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1628 (sizeof(char [1 - 2*!(cond)]) - 1)
1629 #ifndef Py_MEMBER_SIZE
1630 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1632 static size_t __pyx_pyframe_localsplus_offset = 0;
1633 #include "frameobject.h"
1634 #define __Pxy_PyFrame_Initialize_Offsets()\
1635 ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1636 (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1637 #define __Pyx_PyFrame_GetLocalsplus(frame)\
1638 (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1642 #if CYTHON_COMPILING_IN_CPYTHON
1643 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1647 #if CYTHON_COMPILING_IN_CPYTHON
1648 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1650 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1654 #if CYTHON_FAST_PYCCALL
1655 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1657 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
1661 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1664 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1665 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1666 __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1667 (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1668 __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1669 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1670 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1671 __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1672 (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1673 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1674 int wraparound,
int boundscheck);
1675 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1676 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1677 __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1678 (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1679 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1680 int wraparound,
int boundscheck);
1681 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1682 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1683 int is_list,
int wraparound,
int boundscheck);
1686 #if CYTHON_USE_TYPE_SLOTS
1687 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1689 #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
1693 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject*
function, PyObject* arg1, PyObject* arg2);
1696 #if !CYTHON_COMPILING_IN_PYPY
1697 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2,
long intval,
int inplace,
int zerodivision_check);
1699 #define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
1700 (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
1704 #if CYTHON_USE_EXC_INFO_STACK
1705 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1709 #if CYTHON_FAST_THREAD_STATE
1710 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1711 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1712 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1714 #define __Pyx_PyThreadState_declare
1715 #define __Pyx_PyThreadState_assign
1716 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
1720 #if CYTHON_FAST_THREAD_STATE
1721 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1722 static CYTHON_INLINE
void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1723 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1724 static CYTHON_INLINE
void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1726 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1727 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
1731 #if CYTHON_FAST_THREAD_STATE
1732 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
1733 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1735 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1739 #if CYTHON_FAST_THREAD_STATE
1740 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1741 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1742 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1743 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1744 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1745 static CYTHON_INLINE
void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1746 static CYTHON_INLINE
void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1747 #if CYTHON_COMPILING_IN_CPYTHON
1748 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1750 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1753 #define __Pyx_PyErr_Clear() PyErr_Clear()
1754 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1755 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1756 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1757 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1758 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1759 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1760 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1764 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
1765 PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
1766 PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
1767 int has_cstart,
int has_cstop,
int wraparound);
1770 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1773 static void __Pyx_WriteUnraisable(
const char *name,
int clineno,
1774 int lineno,
const char *filename,
1775 int full_traceback,
int nogil);
1778 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
1779 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
1780 #define __Pyx_PyObject_Dict_GetItem(obj, name)\
1781 (likely(PyDict_CheckExact(obj)) ?\
1782 __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
1784 #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
1785 #define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name)
1789 static CYTHON_INLINE
void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1792 static CYTHON_INLINE
void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1795 static CYTHON_INLINE
void __Pyx_RaiseNoneNotIterableError(
void);
1798 #if CYTHON_FAST_THREAD_STATE
1799 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1800 static CYTHON_INLINE
int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1802 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1806 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
1807 ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
1808 __Pyx__ArgTypeTest(obj, type, name, exact))
1809 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type,
const char *name,
int exact);
1815 static CYTHON_INLINE
int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2,
int equals);
1818 static CYTHON_INLINE
int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2,
int equals);
1821 #if PY_MAJOR_VERSION >= 3
1822 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
1824 #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
1828 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t);
1831 #define UNARY_NEG_WOULD_OVERFLOW(x)\
1832 (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
1834 static CYTHON_UNUSED
int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
1835 static PyObject *__pyx_array_get_memview(
struct __pyx_array_obj *);
1837 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
1840 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(
const char *
s, Py_ssize_t size,
const char *errors) {
1842 return PyUnicode_DecodeUTF16(
s, size, errors, &byteorder);
1844 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(
const char *
s, Py_ssize_t size,
const char *errors) {
1846 return PyUnicode_DecodeUTF16(
s, size, errors, &byteorder);
1848 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(
const char *
s, Py_ssize_t size,
const char *errors) {
1850 return PyUnicode_DecodeUTF16(
s, size, errors, &byteorder);
1854 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
1855 const char* cstring, Py_ssize_t start, Py_ssize_t stop,
1856 const char* encoding,
const char* errors,
1857 PyObject* (*decode_func)(
const char *
s, Py_ssize_t size,
const char *errors));
1860 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
1863 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1864 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1865 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1866 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1867 (version_var) = __PYX_GET_DICT_VERSION(dict);\
1868 (cache_var) = (value);
1869 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1870 static PY_UINT64_T __pyx_dict_version = 0;\
1871 static PyObject *__pyx_dict_cached_value = NULL;\
1872 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1873 (VAR) = __pyx_dict_cached_value;\
1875 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1876 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1879 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1880 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1881 static CYTHON_INLINE
int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1883 #define __PYX_GET_DICT_VERSION(dict) (0)
1884 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1885 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1889 #if CYTHON_USE_DICT_VERSIONS
1890 #define __Pyx_GetModuleGlobalName(var, name) {\
1891 static PY_UINT64_T __pyx_dict_version = 0;\
1892 static PyObject *__pyx_dict_cached_value = NULL;\
1893 (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1894 (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1895 __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1897 #define __Pyx_GetModuleGlobalNameUncached(var, name) {\
1898 PY_UINT64_T __pyx_dict_version;\
1899 PyObject *__pyx_dict_cached_value;\
1900 (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1902 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1904 #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1905 #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1906 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1910 #if CYTHON_FAST_THREAD_STATE
1911 #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
1912 static CYTHON_INLINE
void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1914 static CYTHON_INLINE
void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
1918 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list,
int level);
1921 #if CYTHON_COMPILING_IN_CPYTHON
1922 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1923 static CYTHON_INLINE
int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1924 static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1925 static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1927 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1928 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1929 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1931 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1933 static CYTHON_UNUSED
int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
1935 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
1936 static CYTHON_INLINE
int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
1937 PyListObject*
L = (PyListObject*) list;
1938 Py_ssize_t len = Py_SIZE(list);
1939 if (likely(
L->allocated > len)) {
1941 PyList_SET_ITEM(list, len, x);
1942 __Pyx_SET_SIZE(list, len + 1);
1945 return PyList_Append(list, x);
1948 #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
1952 static CYTHON_INLINE
int __Pyx_PyList_Extend(PyObject*
L, PyObject*
v) {
1953 #if CYTHON_COMPILING_IN_CPYTHON
1954 PyObject* none = _PyList_Extend((PyListObject*)
L,
v);
1955 if (unlikely(!none))
1960 return PyList_SetSlice(
L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX,
v);
1965 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
1966 static CYTHON_INLINE
int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
1967 PyListObject*
L = (PyListObject*) list;
1968 Py_ssize_t len = Py_SIZE(list);
1969 if (likely(
L->allocated > len) & likely(len > (
L->allocated >> 1))) {
1971 PyList_SET_ITEM(list, len, x);
1972 __Pyx_SET_SIZE(list, len + 1);
1975 return PyList_Append(list, x);
1978 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
1982 static CYTHON_INLINE
void __Pyx_RaiseUnboundLocalError(
const char *varname);
1985 static CYTHON_INLINE
long __Pyx_div_long(
long,
long);
1988 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1991 static CYTHON_INLINE
int __Pyx_HasAttr(PyObject *, PyObject *);
1994 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1995 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
1997 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
2001 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
2002 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
2004 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
2008 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
2011 static int __Pyx_setup_reduce(PyObject* type_obj);
2014 static int __Pyx_SetVtable(PyObject *dict,
void *vtable);
2017 #ifndef __PYX_HAVE_RT_ImportType_proto
2018 #define __PYX_HAVE_RT_ImportType_proto
2019 enum __Pyx_ImportType_CheckSize {
2020 __Pyx_ImportType_CheckSize_Error = 0,
2021 __Pyx_ImportType_CheckSize_Warn = 1,
2022 __Pyx_ImportType_CheckSize_Ignore = 2
2024 static PyTypeObject *__Pyx_ImportType(PyObject* module,
const char *module_name,
const char *class_name,
size_t size,
enum __Pyx_ImportType_CheckSize check_size);
2028 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);
2031 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
2034 #define __Pyx_CyFunction_USED 1
2035 #define __Pyx_CYFUNCTION_STATICMETHOD 0x01
2036 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
2037 #define __Pyx_CYFUNCTION_CCLASS 0x04
2038 #define __Pyx_CyFunction_GetClosure(f)\
2039 (((__pyx_CyFunctionObject *) (f))->func_closure)
2040 #define __Pyx_CyFunction_GetClassObj(f)\
2041 (((__pyx_CyFunctionObject *) (f))->func_classobj)
2042 #define __Pyx_CyFunction_Defaults(type, f)\
2043 ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
2044 #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
2045 ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
2047 PyCFunctionObject func;
2048 #if PY_VERSION_HEX < 0x030500A0
2049 PyObject *func_weakreflist;
2051 PyObject *func_dict;
2052 PyObject *func_name;
2053 PyObject *func_qualname;
2055 PyObject *func_globals;
2056 PyObject *func_code;
2057 PyObject *func_closure;
2058 PyObject *func_classobj;
2060 int defaults_pyobjects;
2061 size_t defaults_size;
2063 PyObject *defaults_tuple;
2064 PyObject *defaults_kwdict;
2065 PyObject *(*defaults_getter)(PyObject *);
2066 PyObject *func_annotations;
2067 } __pyx_CyFunctionObject;
2068 static PyTypeObject *__pyx_CyFunctionType = 0;
2069 #define __Pyx_CyFunction_Check(obj) (__Pyx_TypeCheck(obj, __pyx_CyFunctionType))
2070 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
2071 int flags, PyObject* qualname,
2073 PyObject *module, PyObject *globals,
2075 static CYTHON_INLINE
void *__Pyx_CyFunction_InitDefaults(PyObject *m,
2078 static CYTHON_INLINE
void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
2080 static CYTHON_INLINE
void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
2082 static CYTHON_INLINE
void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
2084 static int __pyx_CyFunction_init(
void);
2087 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
2088 int flags, PyObject* qualname,
2090 PyObject *module, PyObject *globals,
2094 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
2095 #define __Pyx_SetNameInClass(ns, name, value)\
2096 (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value))
2097 #elif CYTHON_COMPILING_IN_CPYTHON
2098 #define __Pyx_SetNameInClass(ns, name, value)\
2099 (likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value))
2101 #define __Pyx_SetNameInClass(ns, name, value) PyObject_SetItem(ns, name, value)
2105 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
2106 PyObject *mkw, PyObject *modname, PyObject *doc);
2107 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
2108 PyObject *mkw,
int calculate_metaclass,
int allow_py2_metaclass);
2111 #ifdef CYTHON_CLINE_IN_TRACEBACK
2112 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
2114 static int __Pyx_CLineForTraceback(PyThreadState *tstate,
int c_line);
2119 PyCodeObject* code_object;
2121 } __Pyx_CodeObjectCacheEntry;
2122 struct __Pyx_CodeObjectCache {
2125 __Pyx_CodeObjectCacheEntry* entries;
2127 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
2128 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries,
int count,
int code_line);
2129 static PyCodeObject *__pyx_find_code_object(
int code_line);
2130 static void __pyx_insert_code_object(
int code_line, PyCodeObject* code_object);
2133 static void __Pyx_AddTraceback(
const char *funcname,
int c_line,
2134 int py_line,
const char *filename);
2136 #if PY_MAJOR_VERSION < 3
2137 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view,
int flags);
2138 static void __Pyx_ReleaseBuffer(Py_buffer *view);
2140 #define __Pyx_GetBuffer PyObject_GetBuffer
2141 #define __Pyx_ReleaseBuffer PyBuffer_Release
2147 Py_ssize_t shape, strides, suboffsets;
2148 } __Pyx_Buf_DimInfo;
2154 __Pyx_Buffer *rcbuffer;
2156 __Pyx_Buf_DimInfo diminfo[8];
2157 } __Pyx_LocalBuf_ND;
2160 static int __pyx_memviewslice_is_contig(
const __Pyx_memviewslice mvs,
char order,
int ndim);
2163 static int __pyx_slices_overlap(__Pyx_memviewslice *slice1,
2164 __Pyx_memviewslice *slice2,
2165 int ndim,
size_t itemsize);
2168 static CYTHON_INLINE PyObject *__pyx_capsule_create(
void *p,
const char *sig);
2171 static CYTHON_INLINE
int __Pyx_Is_Little_Endian(
void);
2174 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx,
const char* ts);
2175 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
2176 __Pyx_BufFmt_StackElem* stack,
2177 __Pyx_TypeInfo* type);
2180 static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
2183 static int __Pyx_ValidateAndInit_memviewslice(
2188 __Pyx_TypeInfo *dtype,
2189 __Pyx_BufFmt_StackElem stack[],
2190 __Pyx_memviewslice *memviewslice,
2191 PyObject *original_obj);
2194 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(PyObject *,
int writable_flag);
2197 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int32_t(PyObject *,
int writable_flag);
2200 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_int32(npy_int32 value);
2203 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(
int value);
2208 #define __Pyx_CREAL(z) ((z).real())
2209 #define __Pyx_CIMAG(z) ((z).imag())
2211 #define __Pyx_CREAL(z) (__real__(z))
2212 #define __Pyx_CIMAG(z) (__imag__(z))
2215 #define __Pyx_CREAL(z) ((z).real)
2216 #define __Pyx_CIMAG(z) ((z).imag)
2218 #if defined(__cplusplus) && CYTHON_CCOMPLEX\
2219 && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
2220 #define __Pyx_SET_CREAL(z,x) ((z).real(x))
2221 #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
2223 #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
2224 #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
2229 #define __Pyx_c_eq_float(a, b) ((a)==(b))
2230 #define __Pyx_c_sum_float(a, b) ((a)+(b))
2231 #define __Pyx_c_diff_float(a, b) ((a)-(b))
2232 #define __Pyx_c_prod_float(a, b) ((a)*(b))
2233 #define __Pyx_c_quot_float(a, b) ((a)/(b))
2234 #define __Pyx_c_neg_float(a) (-(a))
2236 #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
2237 #define __Pyx_c_conj_float(z) (::std::conj(z))
2239 #define __Pyx_c_abs_float(z) (::std::abs(z))
2240 #define __Pyx_c_pow_float(a, b) (::std::pow(a, b))
2243 #define __Pyx_c_is_zero_float(z) ((z)==0)
2244 #define __Pyx_c_conj_float(z) (conjf(z))
2246 #define __Pyx_c_abs_float(z) (cabsf(z))
2247 #define __Pyx_c_pow_float(a, b) (cpowf(a, b))
2251 static CYTHON_INLINE
int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
2252 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
2253 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
2254 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
2255 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
2256 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
2257 static CYTHON_INLINE
int __Pyx_c_is_zero_float(__pyx_t_float_complex);
2258 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
2260 static CYTHON_INLINE
float __Pyx_c_abs_float(__pyx_t_float_complex);
2261 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
2267 #define __Pyx_c_eq_double(a, b) ((a)==(b))
2268 #define __Pyx_c_sum_double(a, b) ((a)+(b))
2269 #define __Pyx_c_diff_double(a, b) ((a)-(b))
2270 #define __Pyx_c_prod_double(a, b) ((a)*(b))
2271 #define __Pyx_c_quot_double(a, b) ((a)/(b))
2272 #define __Pyx_c_neg_double(a) (-(a))
2274 #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
2275 #define __Pyx_c_conj_double(z) (::std::conj(z))
2277 #define __Pyx_c_abs_double(z) (::std::abs(z))
2278 #define __Pyx_c_pow_double(a, b) (::std::pow(a, b))
2281 #define __Pyx_c_is_zero_double(z) ((z)==0)
2282 #define __Pyx_c_conj_double(z) (conj(z))
2284 #define __Pyx_c_abs_double(z) (cabs(z))
2285 #define __Pyx_c_pow_double(a, b) (cpow(a, b))
2289 static CYTHON_INLINE
int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
2290 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
2291 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
2292 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
2293 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
2294 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
2295 static CYTHON_INLINE
int __Pyx_c_is_zero_double(__pyx_t_double_complex);
2296 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
2298 static CYTHON_INLINE
double __Pyx_c_abs_double(__pyx_t_double_complex);
2299 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
2304 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(
enum NPY_TYPES value);
2307 static __Pyx_memviewslice
2308 __pyx_memoryview_copy_new_contig(
const __Pyx_memviewslice *from_mvs,
2309 const char *mode,
int ndim,
2310 size_t sizeof_dtype,
int contig_flag,
2311 int dtype_is_object);
2314 static CYTHON_INLINE
int __Pyx_PyInt_As_int(PyObject *);
2317 static CYTHON_INLINE npy_int32 __Pyx_PyInt_As_npy_int32(PyObject *);
2320 static CYTHON_INLINE
size_t __Pyx_PyInt_As_size_t(PyObject *);
2323 static CYTHON_INLINE
long __Pyx_PyInt_As_long(PyObject *);
2326 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(
long value);
2329 static CYTHON_INLINE
char __Pyx_PyInt_As_char(PyObject *);
2332 static int __Pyx_check_binary_version(
void);
2335 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
2337 static PyObject *__pyx_f_15superluWrappers_12SparseFactor__set_mat_types(
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_self);
2338 static PyObject *__pyx_array_get_memview(
struct __pyx_array_obj *__pyx_v_self);
2339 static char *__pyx_memoryview_get_item_pointer(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index);
2340 static PyObject *__pyx_memoryview_is_slice(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj);
2341 static PyObject *__pyx_memoryview_setitem_slice_assignment(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src);
2342 static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(
struct __pyx_memoryview_obj *__pyx_v_self,
struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value);
2343 static PyObject *__pyx_memoryview_setitem_indexed(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value);
2344 static PyObject *__pyx_memoryview_convert_item_to_object(
struct __pyx_memoryview_obj *__pyx_v_self,
char *__pyx_v_itemp);
2345 static PyObject *__pyx_memoryview_assign_item_from_object(
struct __pyx_memoryview_obj *__pyx_v_self,
char *__pyx_v_itemp, PyObject *__pyx_v_value);
2346 static PyObject *__pyx_memoryviewslice_convert_item_to_object(
struct __pyx_memoryviewslice_obj *__pyx_v_self,
char *__pyx_v_itemp);
2347 static PyObject *__pyx_memoryviewslice_assign_item_from_object(
struct __pyx_memoryviewslice_obj *__pyx_v_self,
char *__pyx_v_itemp, PyObject *__pyx_v_value);
2358 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
2371 static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
2372 static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
2373 static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
2374 static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
2375 static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
2376 static CYTHON_INLINE
char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *,
char *,
char *,
int *);
2385 static PyTypeObject *__pyx_ptype_15superluWrappers_cSparseMatrix = 0;
2386 static PyTypeObject *__pyx_ptype_15superluWrappers_SparseFactor = 0;
2387 static PyTypeObject *__pyx_array_type = 0;
2388 static PyTypeObject *__pyx_MemviewEnum_type = 0;
2389 static PyTypeObject *__pyx_memoryview_type = 0;
2390 static PyTypeObject *__pyx_memoryviewslice_type = 0;
2391 static PyObject *
generic = 0;
2392 static PyObject *strided = 0;
2393 static PyObject *indirect = 0;
2394 static PyObject *contiguous = 0;
2395 static PyObject *indirect_contiguous = 0;
2396 static int __pyx_memoryview_thread_locks_used;
2397 static PyThread_type_lock __pyx_memoryview_thread_locks[8];
2398 static void __pyx_f_15superluWrappers_SparseMatrix_matvec(
struct __pyx_obj_15superluWrappers_cSparseMatrix *, __Pyx_memviewslice, __Pyx_memviewslice);
2399 static void __pyx_f_15superluWrappers_superluWrappersSparseFactorPrepare(
struct __pyx_obj_15superluWrappers_cSparseMatrix *,
struct __pyx_obj_15superluWrappers_SparseFactor *);
2400 static void __pyx_f_15superluWrappers_superluWrappersSparseFactorSolve(
struct __pyx_obj_15superluWrappers_SparseFactor *, __Pyx_memviewslice);
2401 static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t,
char *,
char *,
char *);
2402 static void *__pyx_align_pointer(
void *,
size_t);
2403 static PyObject *__pyx_memoryview_new(PyObject *,
int,
int, __Pyx_TypeInfo *);
2404 static CYTHON_INLINE
int __pyx_memoryview_check(PyObject *);
2405 static PyObject *_unellipsify(PyObject *,
int);
2406 static PyObject *assert_direct_dimensions(Py_ssize_t *,
int);
2407 static struct __pyx_memoryview_obj *__pyx_memview_slice(
struct __pyx_memoryview_obj *, PyObject *);
2408 static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t,
int,
int,
int *, Py_ssize_t, Py_ssize_t, Py_ssize_t,
int,
int,
int,
int);
2409 static char *__pyx_pybuffer_index(Py_buffer *,
char *, Py_ssize_t, Py_ssize_t);
2410 static int __pyx_memslice_transpose(__Pyx_memviewslice *);
2411 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice,
int, PyObject *(*)(
char *),
int (*)(
char *, PyObject *),
int);
2412 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(
struct __pyx_memoryview_obj *, __Pyx_memviewslice *);
2413 static void __pyx_memoryview_slice_copy(
struct __pyx_memoryview_obj *, __Pyx_memviewslice *);
2414 static PyObject *__pyx_memoryview_copy_object(
struct __pyx_memoryview_obj *);
2415 static PyObject *__pyx_memoryview_copy_object_from_slice(
struct __pyx_memoryview_obj *, __Pyx_memviewslice *);
2416 static Py_ssize_t abs_py_ssize_t(Py_ssize_t);
2417 static char __pyx_get_best_slice_order(__Pyx_memviewslice *,
int);
2418 static void _copy_strided_to_strided(
char *, Py_ssize_t *,
char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *,
int,
size_t);
2419 static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *,
int,
size_t);
2420 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *,
int);
2421 static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t,
int,
char);
2422 static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *,
char,
int);
2423 static int __pyx_memoryview_err_extents(
int, Py_ssize_t, Py_ssize_t);
2424 static int __pyx_memoryview_err_dim(PyObject *,
char *,
int);
2425 static int __pyx_memoryview_err(PyObject *,
char *);
2426 static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice,
int,
int,
int);
2427 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *,
int,
int);
2428 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *,
int,
int,
int);
2429 static void __pyx_memoryview_refcount_objects_in_slice_with_gil(
char *, Py_ssize_t *, Py_ssize_t *,
int,
int);
2430 static void __pyx_memoryview_refcount_objects_in_slice(
char *, Py_ssize_t *, Py_ssize_t *,
int,
int);
2431 static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *,
int,
size_t,
void *,
int);
2432 static void __pyx_memoryview__slice_assign_scalar(
char *, Py_ssize_t *, Py_ssize_t *,
int,
size_t,
void *);
2433 static PyObject *__pyx_unpickle_Enum__set_state(
struct __pyx_MemviewEnum_obj *, PyObject *);
2434 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t = {
"float64_t", NULL,
sizeof(__pyx_t_5numpy_float64_t), { 0 }, 0,
'R', 0, 0 };
2435 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t = {
"int32_t", NULL,
sizeof(__pyx_t_5numpy_int32_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_int32_t) ?
'U' :
'I', IS_UNSIGNED(__pyx_t_5numpy_int32_t), 0 };
2436 #define __Pyx_MODULE_NAME "superluWrappers"
2437 extern int __pyx_module_is_main_superluWrappers;
2438 int __pyx_module_is_main_superluWrappers = 0;
2441 static PyObject *__pyx_builtin_object;
2442 static PyObject *__pyx_builtin_open;
2443 static PyObject *__pyx_builtin_range;
2444 static PyObject *__pyx_builtin_TypeError;
2445 static PyObject *__pyx_builtin_RuntimeError;
2446 static PyObject *__pyx_builtin_ValueError;
2447 static PyObject *__pyx_builtin_ImportError;
2448 static PyObject *__pyx_builtin_MemoryError;
2449 static PyObject *__pyx_builtin_enumerate;
2450 static PyObject *__pyx_builtin_Ellipsis;
2451 static PyObject *__pyx_builtin_id;
2452 static PyObject *__pyx_builtin_IndexError;
2453 static const char __pyx_k_O[] =
"O";
2454 static const char __pyx_k_c[] =
"c";
2455 static const char __pyx_k_i[] =
"i";
2456 static const char __pyx_k_k[] =
"k";
2457 static const char __pyx_k_w[] =
"w";
2458 static const char __pyx_k_x[] =
"x";
2459 static const char __pyx_k_y[] =
"y";
2460 static const char __pyx_k_id[] =
"id";
2461 static const char __pyx_k_nc[] =
"nc";
2462 static const char __pyx_k_np[] =
"np";
2463 static const char __pyx_k_nr[] =
"nr";
2464 static const char __pyx_k_dim[] =
"dim";
2465 static const char __pyx_k_doc[] =
"__doc__";
2466 static const char __pyx_k_new[] =
"__new__";
2467 static const char __pyx_k_nnz[] =
"nnz";
2468 static const char __pyx_k_obj[] =
"obj";
2469 static const char __pyx_k_base[] =
"base";
2470 static const char __pyx_k_dict[] =
"__dict__";
2471 static const char __pyx_k_exit[] =
"__exit__";
2472 static const char __pyx_k_init[] =
"__init__";
2473 static const char __pyx_k_main[] =
"__main__";
2474 static const char __pyx_k_mode[] =
"mode";
2475 static const char __pyx_k_name[] =
"name";
2476 static const char __pyx_k_ndim[] =
"ndim";
2477 static const char __pyx_k_open[] =
"open";
2478 static const char __pyx_k_pack[] =
"pack";
2479 static const char __pyx_k_rows[] =
"_rows";
2480 static const char __pyx_k_self[] =
"self";
2481 static const char __pyx_k_size[] =
"size";
2482 static const char __pyx_k_step[] =
"step";
2483 static const char __pyx_k_stop[] =
"stop";
2484 static const char __pyx_k_test[] =
"__test__";
2485 static const char __pyx_k_ASCII[] =
"ASCII";
2486 static const char __pyx_k_class[] =
"__class__";
2487 static const char __pyx_k_enter[] =
"__enter__";
2488 static const char __pyx_k_error[] =
"error";
2489 static const char __pyx_k_flags[] =
"flags";
2490 static const char __pyx_k_i_i_i[] =
"%i %i %i \n";
2491 static const char __pyx_k_numpy[] =
"numpy";
2492 static const char __pyx_k_nzval[] =
"nzval";
2493 static const char __pyx_k_range[] =
"range";
2494 static const char __pyx_k_shape[] =
"shape";
2495 static const char __pyx_k_start[] =
"start";
2496 static const char __pyx_k_write[] =
"write";
2497 static const char __pyx_k_colind[] =
"colind";
2498 static const char __pyx_k_encode[] =
"encode";
2499 static const char __pyx_k_format[] =
"format";
2500 static const char __pyx_k_fwrite[] =
"fwrite";
2501 static const char __pyx_k_import[] =
"__import__";
2502 static const char __pyx_k_matvec[] =
"matvec";
2503 static const char __pyx_k_module[] =
"__module__";
2504 static const char __pyx_k_name_2[] =
"__name__";
2505 static const char __pyx_k_nzvals[] =
"nzvals";
2506 static const char __pyx_k_object[] =
"object";
2507 static const char __pyx_k_pickle[] =
"pickle";
2508 static const char __pyx_k_reduce[] =
"__reduce__";
2509 static const char __pyx_k_rowptr[] =
"rowptr";
2510 static const char __pyx_k_struct[] =
"struct";
2511 static const char __pyx_k_unpack[] =
"unpack";
2512 static const char __pyx_k_update[] =
"update";
2513 static const char __pyx_k_fortran[] =
"fortran";
2514 static const char __pyx_k_memview[] =
"memview";
2515 static const char __pyx_k_prepare[] =
"__prepare__";
2516 static const char __pyx_k_Ellipsis[] =
"Ellipsis";
2517 static const char __pyx_k_filename[] =
"filename";
2518 static const char __pyx_k_getstate[] =
"__getstate__";
2519 static const char __pyx_k_itemsize[] =
"itemsize";
2520 static const char __pyx_k_pyx_type[] =
"__pyx_type";
2521 static const char __pyx_k_qualname[] =
"__qualname__";
2522 static const char __pyx_k_setstate[] =
"__setstate__";
2523 static const char __pyx_k_TypeError[] =
"TypeError";
2524 static const char __pyx_k_d_d_13_8e[] =
"%d %d %13.8e\n";
2525 static const char __pyx_k_enumerate[] =
"enumerate";
2526 static const char __pyx_k_metaclass[] =
"__metaclass__";
2527 static const char __pyx_k_pyx_state[] =
"__pyx_state";
2528 static const char __pyx_k_range_end[] =
"range_end";
2529 static const char __pyx_k_reduce_ex[] =
"__reduce_ex__";
2530 static const char __pyx_k_IndexError[] =
"IndexError";
2531 static const char __pyx_k_ValueError[] =
"ValueError";
2532 static const char __pyx_k_pyx_result[] =
"__pyx_result";
2533 static const char __pyx_k_pyx_vtable[] =
"__pyx_vtable__";
2534 static const char __pyx_k_ImportError[] =
"ImportError";
2535 static const char __pyx_k_MemoryError[] =
"MemoryError";
2536 static const char __pyx_k_PickleError[] =
"PickleError";
2537 static const char __pyx_k_output_file[] =
"output_file";
2538 static const char __pyx_k_range_start[] =
"range_start";
2539 static const char __pyx_k_RuntimeError[] =
"RuntimeError";
2540 static const char __pyx_k_SparseFactor[] =
"SparseFactor";
2541 static const char __pyx_k_SparseMatrix[] =
"SparseMatrix";
2542 static const char __pyx_k_pyx_checksum[] =
"__pyx_checksum";
2543 static const char __pyx_k_sparseFactor[] =
"sparseFactor";
2544 static const char __pyx_k_stringsource[] =
"stringsource";
2545 static const char __pyx_k_cSparseMatrix[] =
"_cSparseMatrix";
2546 static const char __pyx_k_pyx_getbuffer[] =
"__pyx_getbuffer";
2547 static const char __pyx_k_reduce_cython[] =
"__reduce_cython__";
2548 static const char __pyx_k_sparse_matrix[] =
"sparse_matrix";
2549 static const char __pyx_k_View_MemoryView[] =
"View.MemoryView";
2550 static const char __pyx_k_allocate_buffer[] =
"allocate_buffer";
2551 static const char __pyx_k_cSparseMatrix_2[] =
"cSparseMatrix";
2552 static const char __pyx_k_dtype_is_object[] =
"dtype_is_object";
2553 static const char __pyx_k_pyx_PickleError[] =
"__pyx_PickleError";
2554 static const char __pyx_k_setstate_cython[] =
"__setstate_cython__";
2555 static const char __pyx_k_superluWrappers[] =
"superluWrappers";
2556 static const char __pyx_k_pyx_unpickle_Enum[] =
"__pyx_unpickle_Enum";
2557 static const char __pyx_k_sparseFactorSolve[] =
"sparseFactorSolve";
2558 static const char __pyx_k_cline_in_traceback[] =
"cline_in_traceback";
2559 static const char __pyx_k_strided_and_direct[] =
"<strided and direct>";
2560 static const char __pyx_k_SparseMatrix___init[] =
"SparseMatrix.__init__";
2561 static const char __pyx_k_SparseMatrix_fwrite[] =
"SparseMatrix.fwrite";
2562 static const char __pyx_k_SparseMatrix_matvec[] =
"SparseMatrix.matvec";
2563 static const char __pyx_k_sparseFactorPrepare[] =
"sparseFactorPrepare";
2564 static const char __pyx_k_getCSRrepresentation[] =
"getCSRrepresentation";
2565 static const char __pyx_k_strided_and_indirect[] =
"<strided and indirect>";
2566 static const char __pyx_k_contiguous_and_direct[] =
"<contiguous and direct>";
2567 static const char __pyx_k_MemoryView_of_r_object[] =
"<MemoryView of %r object>";
2568 static const char __pyx_k_MemoryView_of_r_at_0x_x[] =
"<MemoryView of %r at 0x%x>";
2569 static const char __pyx_k_contiguous_and_indirect[] =
"<contiguous and indirect>";
2570 static const char __pyx_k_Cannot_index_with_type_s[] =
"Cannot index with type '%s'";
2571 static const char __pyx_k_Invalid_shape_in_axis_d_d[] =
"Invalid shape in axis %d: %d.";
2572 static const char __pyx_k_getSubMatCSRrepresentation[] =
"getSubMatCSRrepresentation";
2573 static const char __pyx_k_itemsize_0_for_cython_array[] =
"itemsize <= 0 for cython.array";
2574 static const char __pyx_k_proteus_superluWrappers_pyx[] =
"proteus/superluWrappers.pyx";
2575 static const char __pyx_k_unable_to_allocate_array_data[] =
"unable to allocate array data.";
2576 static const char __pyx_k_strided_and_direct_or_indirect[] =
"<strided and direct or indirect>";
2577 static const char __pyx_k_numpy_core_multiarray_failed_to[] =
"numpy.core.multiarray failed to import";
2578 static const char __pyx_k_unknown_dtype_code_in_numpy_pxd[] =
"unknown dtype code in numpy.pxd (%d)";
2579 static const char __pyx_k_Buffer_view_does_not_expose_stri[] =
"Buffer view does not expose strides";
2580 static const char __pyx_k_Can_only_create_a_buffer_that_is[] =
"Can only create a buffer that is contiguous in memory.";
2581 static const char __pyx_k_Cannot_assign_to_read_only_memor[] =
"Cannot assign to read-only memoryview";
2582 static const char __pyx_k_Cannot_create_writable_memory_vi[] =
"Cannot create writable memory view from read-only memoryview";
2583 static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] =
"Empty shape tuple for cython.array";
2584 static const char __pyx_k_Format_string_allocated_too_shor[] =
"Format string allocated too short, see comment in numpy.pxd";
2585 static const char __pyx_k_Incompatible_checksums_s_vs_0xb0[] =
"Incompatible checksums (%s vs 0xb068931 = (name))";
2586 static const char __pyx_k_Indirect_dimensions_not_supporte[] =
"Indirect dimensions not supported";
2587 static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] =
"Invalid mode, expected 'c' or 'fortran', got %s";
2588 static const char __pyx_k_Non_native_byte_order_not_suppor[] =
"Non-native byte order not supported";
2589 static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] =
"Out of bounds on buffer access (axis %d)";
2590 static const char __pyx_k_SparseMatrix_getCSRrepresentatio[] =
"SparseMatrix.getCSRrepresentation";
2591 static const char __pyx_k_SparseMatrix_getSubMatCSRreprese[] =
"SparseMatrix.getSubMatCSRrepresentation";
2592 static const char __pyx_k_Unable_to_convert_item_to_object[] =
"Unable to convert item to object";
2593 static const char __pyx_k_got_differing_extents_in_dimensi[] =
"got differing extents in dimension %d (got %d and %d)";
2594 static const char __pyx_k_no_default___reduce___due_to_non[] =
"no default __reduce__ due to non-trivial __cinit__";
2595 static const char __pyx_k_numpy_core_umath_failed_to_impor[] =
"numpy.core.umath failed to import";
2596 static const char __pyx_k_self_A_self_AC_self_L_self_U_sel[] =
"self.A,self.AC,self.L,self.U,self.X,self.etree,self.perm_c,self.perm_r,self.storeA,self.storeX cannot be converted to a Python object for pickling";
2597 static const char __pyx_k_unable_to_allocate_shape_and_str[] =
"unable to allocate shape and strides.";
2598 static const char __pyx_k_Format_string_allocated_too_shor_2[] =
"Format string allocated too short.";
2599 static PyObject *__pyx_n_s_ASCII;
2600 static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri;
2601 static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is;
2602 static PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor;
2603 static PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi;
2604 static PyObject *__pyx_kp_s_Cannot_index_with_type_s;
2605 static PyObject *__pyx_n_s_Ellipsis;
2606 static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr;
2607 static PyObject *__pyx_kp_u_Format_string_allocated_too_shor;
2608 static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2;
2609 static PyObject *__pyx_n_s_ImportError;
2610 static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xb0;
2611 static PyObject *__pyx_n_s_IndexError;
2612 static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte;
2613 static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr;
2614 static PyObject *__pyx_kp_s_Invalid_shape_in_axis_d_d;
2615 static PyObject *__pyx_n_s_MemoryError;
2616 static PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x;
2617 static PyObject *__pyx_kp_s_MemoryView_of_r_object;
2618 static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor;
2619 static PyObject *__pyx_n_b_O;
2620 static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a;
2621 static PyObject *__pyx_n_s_PickleError;
2622 static PyObject *__pyx_n_s_RuntimeError;
2623 static PyObject *__pyx_n_s_SparseFactor;
2624 static PyObject *__pyx_n_s_SparseMatrix;
2625 static PyObject *__pyx_n_s_SparseMatrix___init;
2626 static PyObject *__pyx_n_s_SparseMatrix_fwrite;
2627 static PyObject *__pyx_n_s_SparseMatrix_getCSRrepresentatio;
2628 static PyObject *__pyx_n_s_SparseMatrix_getSubMatCSRreprese;
2629 static PyObject *__pyx_n_s_SparseMatrix_matvec;
2630 static PyObject *__pyx_n_s_TypeError;
2631 static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object;
2632 static PyObject *__pyx_n_s_ValueError;
2633 static PyObject *__pyx_n_s_View_MemoryView;
2634 static PyObject *__pyx_n_s_allocate_buffer;
2635 static PyObject *__pyx_n_s_base;
2636 static PyObject *__pyx_n_s_c;
2637 static PyObject *__pyx_n_u_c;
2638 static PyObject *__pyx_n_s_cSparseMatrix;
2639 static PyObject *__pyx_n_s_cSparseMatrix_2;
2640 static PyObject *__pyx_n_s_class;
2641 static PyObject *__pyx_n_s_cline_in_traceback;
2642 static PyObject *__pyx_n_s_colind;
2643 static PyObject *__pyx_kp_s_contiguous_and_direct;
2644 static PyObject *__pyx_kp_s_contiguous_and_indirect;
2645 static PyObject *__pyx_kp_s_d_d_13_8e;
2646 static PyObject *__pyx_n_s_dict;
2647 static PyObject *__pyx_n_s_dim;
2648 static PyObject *__pyx_n_s_doc;
2649 static PyObject *__pyx_n_s_dtype_is_object;
2650 static PyObject *__pyx_n_s_encode;
2651 static PyObject *__pyx_n_s_enter;
2652 static PyObject *__pyx_n_s_enumerate;
2653 static PyObject *__pyx_n_s_error;
2654 static PyObject *__pyx_n_s_exit;
2655 static PyObject *__pyx_n_s_filename;
2656 static PyObject *__pyx_n_s_flags;
2657 static PyObject *__pyx_n_s_format;
2658 static PyObject *__pyx_n_s_fortran;
2659 static PyObject *__pyx_n_u_fortran;
2660 static PyObject *__pyx_n_s_fwrite;
2661 static PyObject *__pyx_n_s_getCSRrepresentation;
2662 static PyObject *__pyx_n_s_getSubMatCSRrepresentation;
2663 static PyObject *__pyx_n_s_getstate;
2664 static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi;
2665 static PyObject *__pyx_n_s_i;
2666 static PyObject *__pyx_kp_s_i_i_i;
2667 static PyObject *__pyx_n_s_id;
2668 static PyObject *__pyx_n_s_import;
2669 static PyObject *__pyx_n_s_init;
2670 static PyObject *__pyx_n_s_itemsize;
2671 static PyObject *__pyx_kp_s_itemsize_0_for_cython_array;
2672 static PyObject *__pyx_n_s_k;
2673 static PyObject *__pyx_n_s_main;
2674 static PyObject *__pyx_n_s_matvec;
2675 static PyObject *__pyx_n_s_memview;
2676 static PyObject *__pyx_n_s_metaclass;
2677 static PyObject *__pyx_n_s_mode;
2678 static PyObject *__pyx_n_s_module;
2679 static PyObject *__pyx_n_s_name;
2680 static PyObject *__pyx_n_s_name_2;
2681 static PyObject *__pyx_n_s_nc;
2682 static PyObject *__pyx_n_s_ndim;
2683 static PyObject *__pyx_n_s_new;
2684 static PyObject *__pyx_n_s_nnz;
2685 static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
2686 static PyObject *__pyx_n_s_np;
2687 static PyObject *__pyx_n_s_nr;
2688 static PyObject *__pyx_n_s_numpy;
2689 static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
2690 static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
2691 static PyObject *__pyx_n_s_nzval;
2692 static PyObject *__pyx_n_s_nzvals;
2693 static PyObject *__pyx_n_s_obj;
2694 static PyObject *__pyx_n_s_object;
2695 static PyObject *__pyx_n_s_open;
2696 static PyObject *__pyx_n_s_output_file;
2697 static PyObject *__pyx_n_s_pack;
2698 static PyObject *__pyx_n_s_pickle;
2699 static PyObject *__pyx_n_s_prepare;
2700 static PyObject *__pyx_kp_s_proteus_superluWrappers_pyx;
2701 static PyObject *__pyx_n_s_pyx_PickleError;
2702 static PyObject *__pyx_n_s_pyx_checksum;
2703 static PyObject *__pyx_n_s_pyx_getbuffer;
2704 static PyObject *__pyx_n_s_pyx_result;
2705 static PyObject *__pyx_n_s_pyx_state;
2706 static PyObject *__pyx_n_s_pyx_type;
2707 static PyObject *__pyx_n_s_pyx_unpickle_Enum;
2708 static PyObject *__pyx_n_s_pyx_vtable;
2709 static PyObject *__pyx_n_s_qualname;
2710 static PyObject *__pyx_n_s_range;
2711 static PyObject *__pyx_n_s_range_end;
2712 static PyObject *__pyx_n_s_range_start;
2713 static PyObject *__pyx_n_s_reduce;
2714 static PyObject *__pyx_n_s_reduce_cython;
2715 static PyObject *__pyx_n_s_reduce_ex;
2716 static PyObject *__pyx_n_s_rowptr;
2717 static PyObject *__pyx_n_s_rows;
2718 static PyObject *__pyx_n_s_self;
2719 static PyObject *__pyx_kp_s_self_A_self_AC_self_L_self_U_sel;
2720 static PyObject *__pyx_n_s_setstate;
2721 static PyObject *__pyx_n_s_setstate_cython;
2722 static PyObject *__pyx_n_s_shape;
2723 static PyObject *__pyx_n_s_size;
2724 static PyObject *__pyx_n_s_sparseFactor;
2725 static PyObject *__pyx_n_s_sparseFactorPrepare;
2726 static PyObject *__pyx_n_s_sparseFactorSolve;
2727 static PyObject *__pyx_n_s_sparse_matrix;
2728 static PyObject *__pyx_n_s_start;
2729 static PyObject *__pyx_n_s_step;
2730 static PyObject *__pyx_n_s_stop;
2731 static PyObject *__pyx_kp_s_strided_and_direct;
2732 static PyObject *__pyx_kp_s_strided_and_direct_or_indirect;
2733 static PyObject *__pyx_kp_s_strided_and_indirect;
2734 static PyObject *__pyx_kp_s_stringsource;
2735 static PyObject *__pyx_n_s_struct;
2736 static PyObject *__pyx_n_s_superluWrappers;
2737 static PyObject *__pyx_n_s_test;
2738 static PyObject *__pyx_kp_s_unable_to_allocate_array_data;
2739 static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str;
2740 static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd;
2741 static PyObject *__pyx_n_s_unpack;
2742 static PyObject *__pyx_n_s_update;
2743 static PyObject *__pyx_n_s_w;
2744 static PyObject *__pyx_n_s_write;
2745 static PyObject *__pyx_n_s_x;
2746 static PyObject *__pyx_n_s_y;
2747 static PyObject *__pyx_pf_15superluWrappers_12SparseMatrix___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_nr, PyObject *__pyx_v_nc, PyObject *__pyx_v_nnz, PyObject *__pyx_v_nzvals, PyObject *__pyx_v_colind, PyObject *__pyx_v_rowptr);
2748 static PyObject *__pyx_pf_15superluWrappers_12SparseMatrix_2matvec(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y);
2749 static PyObject *__pyx_pf_15superluWrappers_12SparseMatrix_4fwrite(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_base);
2750 static PyObject *__pyx_pf_15superluWrappers_12SparseMatrix_6getCSRrepresentation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self);
2751 static PyObject *__pyx_pf_15superluWrappers_12SparseMatrix_8getSubMatCSRrepresentation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_range_start, PyObject *__pyx_v_range_end);
2752 static int __pyx_pf_15superluWrappers_13cSparseMatrix___cinit__(
struct __pyx_obj_15superluWrappers_cSparseMatrix *__pyx_v_self,
int __pyx_v_nr,
int __pyx_v_nc,
int __pyx_v_nnz, __Pyx_memviewslice __pyx_v_nzval, __Pyx_memviewslice __pyx_v_colind, __Pyx_memviewslice __pyx_v_rowptr);
2753 static PyObject *__pyx_pf_15superluWrappers_13cSparseMatrix_2__reduce_cython__(CYTHON_UNUSED
struct __pyx_obj_15superluWrappers_cSparseMatrix *__pyx_v_self);
2754 static PyObject *__pyx_pf_15superluWrappers_13cSparseMatrix_4__setstate_cython__(CYTHON_UNUSED
struct __pyx_obj_15superluWrappers_cSparseMatrix *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state);
2755 static int __pyx_pf_15superluWrappers_12SparseFactor___init__(
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_self, PyObject *__pyx_v_dim);
2756 static PyObject *__pyx_pf_15superluWrappers_12SparseFactor_3dim___get__(
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_self);
2757 static int __pyx_pf_15superluWrappers_12SparseFactor_3dim_2__set__(
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_self, PyObject *__pyx_v_value);
2758 static PyObject *__pyx_pf_15superluWrappers_12SparseFactor_2__reduce_cython__(CYTHON_UNUSED
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_self);
2759 static PyObject *__pyx_pf_15superluWrappers_12SparseFactor_4__setstate_cython__(CYTHON_UNUSED
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state);
2760 static PyObject *__pyx_pf_15superluWrappers_sparseFactorPrepare(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sparse_matrix, PyObject *__pyx_v_sparseFactor);
2761 static PyObject *__pyx_pf_15superluWrappers_2sparseFactorSolve(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sparseFactor, PyObject *__pyx_v_x);
2762 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode,
int __pyx_v_allocate_buffer);
2763 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(
struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
2764 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(
struct __pyx_array_obj *__pyx_v_self);
2765 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(
struct __pyx_array_obj *__pyx_v_self);
2766 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(
struct __pyx_array_obj *__pyx_v_self);
2767 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr);
2768 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item);
2769 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value);
2770 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED
struct __pyx_array_obj *__pyx_v_self);
2771 static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state);
2772 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(
struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name);
2773 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(
struct __pyx_MemviewEnum_obj *__pyx_v_self);
2774 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(
struct __pyx_MemviewEnum_obj *__pyx_v_self);
2775 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(
struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state);
2776 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj,
int __pyx_v_flags,
int __pyx_v_dtype_is_object);
2777 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(
struct __pyx_memoryview_obj *__pyx_v_self);
2778 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index);
2779 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value);
2780 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(
struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
2781 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2782 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2783 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2784 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2785 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2786 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2787 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2788 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2789 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2790 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(
struct __pyx_memoryview_obj *__pyx_v_self);
2791 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(
struct __pyx_memoryview_obj *__pyx_v_self);
2792 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(
struct __pyx_memoryview_obj *__pyx_v_self);
2793 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(
struct __pyx_memoryview_obj *__pyx_v_self);
2794 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(
struct __pyx_memoryview_obj *__pyx_v_self);
2795 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(
struct __pyx_memoryview_obj *__pyx_v_self);
2796 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(
struct __pyx_memoryview_obj *__pyx_v_self);
2797 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED
struct __pyx_memoryview_obj *__pyx_v_self);
2798 static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state);
2799 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(
struct __pyx_memoryviewslice_obj *__pyx_v_self);
2800 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(
struct __pyx_memoryviewslice_obj *__pyx_v_self);
2801 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED
struct __pyx_memoryviewslice_obj *__pyx_v_self);
2802 static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state);
2803 static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type,
long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state);
2804 static PyObject *__pyx_tp_new_15superluWrappers_cSparseMatrix(PyTypeObject *t, PyObject *a, PyObject *k);
2805 static PyObject *__pyx_tp_new_15superluWrappers_SparseFactor(PyTypeObject *t, PyObject *a, PyObject *k);
2806 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k);
2807 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k);
2808 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k);
2809 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k);
2810 static PyObject *__pyx_int_0;
2811 static PyObject *__pyx_int_1;
2812 static PyObject *__pyx_int_184977713;
2813 static PyObject *__pyx_int_neg_1;
2814 static PyObject *__pyx_tuple_;
2815 static PyObject *__pyx_tuple__2;
2816 static PyObject *__pyx_tuple__3;
2817 static PyObject *__pyx_tuple__4;
2818 static PyObject *__pyx_tuple__5;
2819 static PyObject *__pyx_tuple__6;
2820 static PyObject *__pyx_tuple__7;
2821 static PyObject *__pyx_tuple__8;
2822 static PyObject *__pyx_tuple__9;
2823 static PyObject *__pyx_slice__25;
2824 static PyObject *__pyx_tuple__10;
2825 static PyObject *__pyx_tuple__11;
2826 static PyObject *__pyx_tuple__12;
2827 static PyObject *__pyx_tuple__13;
2828 static PyObject *__pyx_tuple__14;
2829 static PyObject *__pyx_tuple__15;
2830 static PyObject *__pyx_tuple__16;
2831 static PyObject *__pyx_tuple__17;
2832 static PyObject *__pyx_tuple__18;
2833 static PyObject *__pyx_tuple__19;
2834 static PyObject *__pyx_tuple__20;
2835 static PyObject *__pyx_tuple__21;
2836 static PyObject *__pyx_tuple__22;
2837 static PyObject *__pyx_tuple__23;
2838 static PyObject *__pyx_tuple__24;
2839 static PyObject *__pyx_tuple__26;
2840 static PyObject *__pyx_tuple__27;
2841 static PyObject *__pyx_tuple__28;
2842 static PyObject *__pyx_tuple__29;
2843 static PyObject *__pyx_tuple__30;
2844 static PyObject *__pyx_tuple__32;
2845 static PyObject *__pyx_tuple__34;
2846 static PyObject *__pyx_tuple__36;
2847 static PyObject *__pyx_tuple__38;
2848 static PyObject *__pyx_tuple__40;
2849 static PyObject *__pyx_tuple__42;
2850 static PyObject *__pyx_tuple__44;
2851 static PyObject *__pyx_tuple__45;
2852 static PyObject *__pyx_tuple__46;
2853 static PyObject *__pyx_tuple__47;
2854 static PyObject *__pyx_tuple__48;
2855 static PyObject *__pyx_tuple__49;
2856 static PyObject *__pyx_codeobj__31;
2857 static PyObject *__pyx_codeobj__33;
2858 static PyObject *__pyx_codeobj__35;
2859 static PyObject *__pyx_codeobj__37;
2860 static PyObject *__pyx_codeobj__39;
2861 static PyObject *__pyx_codeobj__41;
2862 static PyObject *__pyx_codeobj__43;
2863 static PyObject *__pyx_codeobj__50;
2875 static PyObject *__pyx_pw_15superluWrappers_12SparseMatrix_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
2876 static PyMethodDef __pyx_mdef_15superluWrappers_12SparseMatrix_1__init__ = {
"__init__", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_15superluWrappers_12SparseMatrix_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
2877 static PyObject *__pyx_pw_15superluWrappers_12SparseMatrix_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2878 PyObject *__pyx_v_self = 0;
2879 PyObject *__pyx_v_nr = 0;
2880 PyObject *__pyx_v_nc = 0;
2881 PyObject *__pyx_v_nnz = 0;
2882 PyObject *__pyx_v_nzvals = 0;
2883 PyObject *__pyx_v_colind = 0;
2884 PyObject *__pyx_v_rowptr = 0;
2885 int __pyx_lineno = 0;
2886 const char *__pyx_filename = NULL;
2887 int __pyx_clineno = 0;
2888 PyObject *__pyx_r = 0;
2889 __Pyx_RefNannyDeclarations
2890 __Pyx_RefNannySetupContext(
"__init__ (wrapper)", 0);
2892 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_nr,&__pyx_n_s_nc,&__pyx_n_s_nnz,&__pyx_n_s_nzvals,&__pyx_n_s_colind,&__pyx_n_s_rowptr,0};
2893 PyObject* values[7] = {0,0,0,0,0,0,0};
2894 if (unlikely(__pyx_kwds)) {
2896 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2898 case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
2900 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
2902 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2904 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2906 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2908 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2910 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2913 default:
goto __pyx_L5_argtuple_error;
2915 kw_args = PyDict_Size(__pyx_kwds);
2918 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
2919 else goto __pyx_L5_argtuple_error;
2922 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nr)) != 0)) kw_args--;
2924 __Pyx_RaiseArgtupleInvalid(
"__init__", 1, 7, 7, 1); __PYX_ERR(0, 15, __pyx_L3_error)
2928 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nc)) != 0)) kw_args--;
2930 __Pyx_RaiseArgtupleInvalid(
"__init__", 1, 7, 7, 2); __PYX_ERR(0, 15, __pyx_L3_error)
2934 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nnz)) != 0)) kw_args--;
2936 __Pyx_RaiseArgtupleInvalid(
"__init__", 1, 7, 7, 3); __PYX_ERR(0, 15, __pyx_L3_error)
2940 if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nzvals)) != 0)) kw_args--;
2942 __Pyx_RaiseArgtupleInvalid(
"__init__", 1, 7, 7, 4); __PYX_ERR(0, 15, __pyx_L3_error)
2946 if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_colind)) != 0)) kw_args--;
2948 __Pyx_RaiseArgtupleInvalid(
"__init__", 1, 7, 7, 5); __PYX_ERR(0, 15, __pyx_L3_error)
2952 if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rowptr)) != 0)) kw_args--;
2954 __Pyx_RaiseArgtupleInvalid(
"__init__", 1, 7, 7, 6); __PYX_ERR(0, 15, __pyx_L3_error)
2957 if (unlikely(kw_args > 0)) {
2958 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__init__") < 0)) __PYX_ERR(0, 15, __pyx_L3_error)
2960 }
else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
2961 goto __pyx_L5_argtuple_error;
2963 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2964 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2965 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2966 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2967 values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2968 values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
2969 values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
2971 __pyx_v_self = values[0];
2972 __pyx_v_nr = values[1];
2973 __pyx_v_nc = values[2];
2974 __pyx_v_nnz = values[3];
2975 __pyx_v_nzvals = values[4];
2976 __pyx_v_colind = values[5];
2977 __pyx_v_rowptr = values[6];
2979 goto __pyx_L4_argument_unpacking_done;
2980 __pyx_L5_argtuple_error:;
2981 __Pyx_RaiseArgtupleInvalid(
"__init__", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 15, __pyx_L3_error)
2983 __Pyx_AddTraceback(
"superluWrappers.SparseMatrix.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2984 __Pyx_RefNannyFinishContext();
2986 __pyx_L4_argument_unpacking_done:;
2987 __pyx_r = __pyx_pf_15superluWrappers_12SparseMatrix___init__(__pyx_self, __pyx_v_self, __pyx_v_nr, __pyx_v_nc, __pyx_v_nnz, __pyx_v_nzvals, __pyx_v_colind, __pyx_v_rowptr);
2990 __Pyx_RefNannyFinishContext();
2994 static PyObject *__pyx_pf_15superluWrappers_12SparseMatrix___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_nr, PyObject *__pyx_v_nc, PyObject *__pyx_v_nnz, PyObject *__pyx_v_nzvals, PyObject *__pyx_v_colind, PyObject *__pyx_v_rowptr) {
2995 PyObject *__pyx_r = NULL;
2996 __Pyx_RefNannyDeclarations
2997 PyObject *__pyx_t_1 = NULL;
2998 PyObject *__pyx_t_2 = NULL;
2999 PyObject *__pyx_t_3 = NULL;
3000 PyObject *__pyx_t_4 = NULL;
3001 int __pyx_lineno = 0;
3002 const char *__pyx_filename = NULL;
3003 int __pyx_clineno = 0;
3004 __Pyx_RefNannySetupContext(
"__init__", 0);
3013 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_nr, __pyx_v_nr) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
3014 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_nc, __pyx_v_nc) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
3023 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_nnz, __pyx_v_nnz) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
3032 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nr);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error)
3033 __Pyx_GOTREF(__pyx_t_1);
3034 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nc);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error)
3035 __Pyx_GOTREF(__pyx_t_2);
3036 __pyx_t_3 = PyList_New(2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 24, __pyx_L1_error)
3037 __Pyx_GOTREF(__pyx_t_3);
3038 __Pyx_GIVEREF(__pyx_t_1);
3039 PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
3040 __Pyx_GIVEREF(__pyx_t_2);
3041 PyList_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
3044 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_shape, __pyx_t_3) < 0) __PYX_ERR(0, 24, __pyx_L1_error)
3045 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3054 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_nzvals, __pyx_v_nzvals) < 0) __PYX_ERR(0, 25, __pyx_L1_error)
3063 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_colind, __pyx_v_colind) < 0) __PYX_ERR(0, 26, __pyx_L1_error)
3072 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_rowptr, __pyx_v_rowptr) < 0) __PYX_ERR(0, 27, __pyx_L1_error)
3081 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nzvals);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 31, __pyx_L1_error)
3082 __Pyx_GOTREF(__pyx_t_3);
3091 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_colind);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error)
3092 __Pyx_GOTREF(__pyx_t_2);
3101 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rowptr);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 33, __pyx_L1_error)
3102 __Pyx_GOTREF(__pyx_t_1);
3111 __pyx_t_4 = PyTuple_New(6);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 28, __pyx_L1_error)
3112 __Pyx_GOTREF(__pyx_t_4);
3113 __Pyx_INCREF(__pyx_v_nr);
3114 __Pyx_GIVEREF(__pyx_v_nr);
3115 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_nr);
3116 __Pyx_INCREF(__pyx_v_nc);
3117 __Pyx_GIVEREF(__pyx_v_nc);
3118 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_nc);
3119 __Pyx_INCREF(__pyx_v_nnz);
3120 __Pyx_GIVEREF(__pyx_v_nnz);
3121 PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_nnz);
3122 __Pyx_GIVEREF(__pyx_t_3);
3123 PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_3);
3124 __Pyx_GIVEREF(__pyx_t_2);
3125 PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_t_2);
3126 __Pyx_GIVEREF(__pyx_t_1);
3127 PyTuple_SET_ITEM(__pyx_t_4, 5, __pyx_t_1);
3131 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_15superluWrappers_cSparseMatrix), __pyx_t_4, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error)
3132 __Pyx_GOTREF(__pyx_t_1);
3133 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3134 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cSparseMatrix, __pyx_t_1) < 0) __PYX_ERR(0, 28, __pyx_L1_error)
3135 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3146 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3149 __Pyx_XDECREF(__pyx_t_1);
3150 __Pyx_XDECREF(__pyx_t_2);
3151 __Pyx_XDECREF(__pyx_t_3);
3152 __Pyx_XDECREF(__pyx_t_4);
3153 __Pyx_AddTraceback(
"superluWrappers.SparseMatrix.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3156 __Pyx_XGIVEREF(__pyx_r);
3157 __Pyx_RefNannyFinishContext();
3170 static PyObject *__pyx_pw_15superluWrappers_12SparseMatrix_3matvec(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
3171 static char __pyx_doc_15superluWrappers_12SparseMatrix_2matvec[] =
"\n Compute the sparse matrix-vector product y = Ax\n\n Arguments\n ---------\n x (input) : numpy array\n y (output) : numpy array\n ";
3172 static PyMethodDef __pyx_mdef_15superluWrappers_12SparseMatrix_3matvec = {
"matvec", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_15superluWrappers_12SparseMatrix_3matvec, METH_VARARGS|METH_KEYWORDS, __pyx_doc_15superluWrappers_12SparseMatrix_2matvec};
3173 static PyObject *__pyx_pw_15superluWrappers_12SparseMatrix_3matvec(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3174 PyObject *__pyx_v_self = 0;
3175 PyObject *__pyx_v_x = 0;
3176 PyObject *__pyx_v_y = 0;
3177 int __pyx_lineno = 0;
3178 const char *__pyx_filename = NULL;
3179 int __pyx_clineno = 0;
3180 PyObject *__pyx_r = 0;
3181 __Pyx_RefNannyDeclarations
3182 __Pyx_RefNannySetupContext(
"matvec (wrapper)", 0);
3184 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_x,&__pyx_n_s_y,0};
3185 PyObject* values[3] = {0,0,0};
3186 if (unlikely(__pyx_kwds)) {
3188 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3190 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3192 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3194 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3197 default:
goto __pyx_L5_argtuple_error;
3199 kw_args = PyDict_Size(__pyx_kwds);
3202 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
3203 else goto __pyx_L5_argtuple_error;
3206 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
3208 __Pyx_RaiseArgtupleInvalid(
"matvec", 1, 3, 3, 1); __PYX_ERR(0, 35, __pyx_L3_error)
3212 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
3214 __Pyx_RaiseArgtupleInvalid(
"matvec", 1, 3, 3, 2); __PYX_ERR(0, 35, __pyx_L3_error)
3217 if (unlikely(kw_args > 0)) {
3218 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"matvec") < 0)) __PYX_ERR(0, 35, __pyx_L3_error)
3220 }
else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
3221 goto __pyx_L5_argtuple_error;
3223 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3224 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3225 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3227 __pyx_v_self = values[0];
3228 __pyx_v_x = values[1];
3229 __pyx_v_y = values[2];
3231 goto __pyx_L4_argument_unpacking_done;
3232 __pyx_L5_argtuple_error:;
3233 __Pyx_RaiseArgtupleInvalid(
"matvec", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 35, __pyx_L3_error)
3235 __Pyx_AddTraceback(
"superluWrappers.SparseMatrix.matvec", __pyx_clineno, __pyx_lineno, __pyx_filename);
3236 __Pyx_RefNannyFinishContext();
3238 __pyx_L4_argument_unpacking_done:;
3239 __pyx_r = __pyx_pf_15superluWrappers_12SparseMatrix_2matvec(__pyx_self, __pyx_v_self, __pyx_v_x, __pyx_v_y);
3242 __Pyx_RefNannyFinishContext();
3246 static PyObject *__pyx_pf_15superluWrappers_12SparseMatrix_2matvec(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
3247 PyObject *__pyx_r = NULL;
3248 __Pyx_RefNannyDeclarations
3249 PyObject *__pyx_t_1 = NULL;
3250 __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } };
3251 __Pyx_memviewslice __pyx_t_3 = { 0, 0, { 0 }, { 0 }, { 0 } };
3252 int __pyx_lineno = 0;
3253 const char *__pyx_filename = NULL;
3254 int __pyx_clineno = 0;
3255 __Pyx_RefNannySetupContext(
"matvec", 0);
3264 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cSparseMatrix);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error)
3265 __Pyx_GOTREF(__pyx_t_1);
3266 if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_15superluWrappers_cSparseMatrix))))) __PYX_ERR(0, 44, __pyx_L1_error)
3267 __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(__pyx_v_x, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 44, __pyx_L1_error)
3268 __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(__pyx_v_y, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 44, __pyx_L1_error)
3269 __pyx_f_15superluWrappers_SparseMatrix_matvec(((
struct __pyx_obj_15superluWrappers_cSparseMatrix *)__pyx_t_1), __pyx_t_2, __pyx_t_3);
3270 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3271 __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
3272 __pyx_t_2.memview = NULL;
3273 __pyx_t_2.data = NULL;
3274 __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
3275 __pyx_t_3.memview = NULL;
3276 __pyx_t_3.data = NULL;
3287 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3290 __Pyx_XDECREF(__pyx_t_1);
3291 __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
3292 __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
3293 __Pyx_AddTraceback(
"superluWrappers.SparseMatrix.matvec", __pyx_clineno, __pyx_lineno, __pyx_filename);
3296 __Pyx_XGIVEREF(__pyx_r);
3297 __Pyx_RefNannyFinishContext();
3310 static PyObject *__pyx_pw_15superluWrappers_12SparseMatrix_5fwrite(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
3311 static char __pyx_doc_15superluWrappers_12SparseMatrix_4fwrite[] =
" Write the sparse matrix to a file\n\n Arguments\n ---------\n filename : str\n The output filename\n base : int\n ?!Possibly something to do with parallel?!\n ";
3312 static PyMethodDef __pyx_mdef_15superluWrappers_12SparseMatrix_5fwrite = {
"fwrite", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_15superluWrappers_12SparseMatrix_5fwrite, METH_VARARGS|METH_KEYWORDS, __pyx_doc_15superluWrappers_12SparseMatrix_4fwrite};
3313 static PyObject *__pyx_pw_15superluWrappers_12SparseMatrix_5fwrite(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3314 PyObject *__pyx_v_self = 0;
3315 PyObject *__pyx_v_filename = 0;
3316 PyObject *__pyx_v_base = 0;
3317 int __pyx_lineno = 0;
3318 const char *__pyx_filename = NULL;
3319 int __pyx_clineno = 0;
3320 PyObject *__pyx_r = 0;
3321 __Pyx_RefNannyDeclarations
3322 __Pyx_RefNannySetupContext(
"fwrite (wrapper)", 0);
3324 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_filename,&__pyx_n_s_base,0};
3325 PyObject* values[3] = {0,0,0};
3326 if (unlikely(__pyx_kwds)) {
3328 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3330 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3332 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3334 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3337 default:
goto __pyx_L5_argtuple_error;
3339 kw_args = PyDict_Size(__pyx_kwds);
3342 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
3343 else goto __pyx_L5_argtuple_error;
3346 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
3348 __Pyx_RaiseArgtupleInvalid(
"fwrite", 1, 3, 3, 1); __PYX_ERR(0, 46, __pyx_L3_error)
3352 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_base)) != 0)) kw_args--;
3354 __Pyx_RaiseArgtupleInvalid(
"fwrite", 1, 3, 3, 2); __PYX_ERR(0, 46, __pyx_L3_error)
3357 if (unlikely(kw_args > 0)) {
3358 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"fwrite") < 0)) __PYX_ERR(0, 46, __pyx_L3_error)
3360 }
else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
3361 goto __pyx_L5_argtuple_error;
3363 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3364 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3365 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3367 __pyx_v_self = values[0];
3368 __pyx_v_filename = values[1];
3369 __pyx_v_base = values[2];
3371 goto __pyx_L4_argument_unpacking_done;
3372 __pyx_L5_argtuple_error:;
3373 __Pyx_RaiseArgtupleInvalid(
"fwrite", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 46, __pyx_L3_error)
3375 __Pyx_AddTraceback(
"superluWrappers.SparseMatrix.fwrite", __pyx_clineno, __pyx_lineno, __pyx_filename);
3376 __Pyx_RefNannyFinishContext();
3378 __pyx_L4_argument_unpacking_done:;
3379 __pyx_r = __pyx_pf_15superluWrappers_12SparseMatrix_4fwrite(__pyx_self, __pyx_v_self, __pyx_v_filename, __pyx_v_base);
3382 __Pyx_RefNannyFinishContext();
3386 static PyObject *__pyx_pf_15superluWrappers_12SparseMatrix_4fwrite(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_base) {
3387 PyObject *__pyx_v_output_file = NULL;
3388 PyObject *__pyx_v_i = NULL;
3389 PyObject *__pyx_v_k = NULL;
3390 PyObject *__pyx_r = NULL;
3391 __Pyx_RefNannyDeclarations
3392 PyObject *__pyx_t_1 = NULL;
3393 PyObject *__pyx_t_2 = NULL;
3394 PyObject *__pyx_t_3 = NULL;
3395 PyObject *__pyx_t_4 = NULL;
3396 PyObject *__pyx_t_5 = NULL;
3397 PyObject *__pyx_t_6 = NULL;
3398 PyObject *__pyx_t_7 = NULL;
3399 PyObject *__pyx_t_8 = NULL;
3400 PyObject *__pyx_t_9 = NULL;
3401 PyObject *__pyx_t_10 = NULL;
3402 PyObject *__pyx_t_11 = NULL;
3403 Py_ssize_t __pyx_t_12;
3404 PyObject *(*__pyx_t_13)(PyObject *);
3405 Py_ssize_t __pyx_t_14;
3406 PyObject *(*__pyx_t_15)(PyObject *);
3407 PyObject *__pyx_t_16 = NULL;
3408 PyObject *__pyx_t_17 = NULL;
3411 int __pyx_lineno = 0;
3412 const char *__pyx_filename = NULL;
3413 int __pyx_clineno = 0;
3414 __Pyx_RefNannySetupContext(
"fwrite", 0);
3424 __pyx_t_1 = PyTuple_New(2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error)
3425 __Pyx_GOTREF(__pyx_t_1);
3426 __Pyx_INCREF(__pyx_v_filename);
3427 __Pyx_GIVEREF(__pyx_v_filename);
3428 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_filename);
3429 __Pyx_INCREF(__pyx_n_s_w);
3430 __Pyx_GIVEREF(__pyx_n_s_w);
3431 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_w);
3432 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_1, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error)
3433 __Pyx_GOTREF(__pyx_t_2);
3434 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3435 __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_n_s_exit);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 56, __pyx_L1_error)
3436 __Pyx_GOTREF(__pyx_t_3);
3437 __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_n_s_enter);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 56, __pyx_L3_error)
3438 __Pyx_GOTREF(__pyx_t_4);
3440 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
3441 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
3442 if (likely(__pyx_t_5)) {
3443 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_4);
3444 __Pyx_INCREF(__pyx_t_5);
3445 __Pyx_INCREF(
function);
3446 __Pyx_DECREF_SET(__pyx_t_4,
function);
3449 __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
3450 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
3451 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L3_error)
3452 __Pyx_GOTREF(__pyx_t_1);
3453 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3454 __pyx_t_4 = __pyx_t_1;
3456 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3459 __Pyx_PyThreadState_declare
3460 __Pyx_PyThreadState_assign
3461 __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
3462 __Pyx_XGOTREF(__pyx_t_6);
3463 __Pyx_XGOTREF(__pyx_t_7);
3464 __Pyx_XGOTREF(__pyx_t_8);
3466 __pyx_v_output_file = __pyx_t_4;
3476 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_output_file, __pyx_n_s_write);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 57, __pyx_L7_error)
3477 __Pyx_GOTREF(__pyx_t_2);
3478 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nr);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 57, __pyx_L7_error)
3479 __Pyx_GOTREF(__pyx_t_1);
3480 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nc);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 57, __pyx_L7_error)
3481 __Pyx_GOTREF(__pyx_t_5);
3482 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rowptr);
if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 57, __pyx_L7_error)
3483 __Pyx_GOTREF(__pyx_t_9);
3484 __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nr);
if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 57, __pyx_L7_error)
3485 __Pyx_GOTREF(__pyx_t_10);
3486 __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_t_9, __pyx_t_10);
if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 57, __pyx_L7_error)
3487 __Pyx_GOTREF(__pyx_t_11);
3488 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3489 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3490 __pyx_t_10 = PyTuple_New(3);
if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 57, __pyx_L7_error)
3491 __Pyx_GOTREF(__pyx_t_10);
3492 __Pyx_GIVEREF(__pyx_t_1);
3493 PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1);
3494 __Pyx_GIVEREF(__pyx_t_5);
3495 PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_5);
3496 __Pyx_GIVEREF(__pyx_t_11);
3497 PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_11);
3501 __pyx_t_11 = __Pyx_PyString_Format(__pyx_kp_s_i_i_i, __pyx_t_10);
if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 57, __pyx_L7_error)
3502 __Pyx_GOTREF(__pyx_t_11);
3503 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3505 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
3506 __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_2);
3507 if (likely(__pyx_t_10)) {
3508 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_2);
3509 __Pyx_INCREF(__pyx_t_10);
3510 __Pyx_INCREF(
function);
3511 __Pyx_DECREF_SET(__pyx_t_2,
function);
3514 __pyx_t_4 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_10, __pyx_t_11) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_11);
3515 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
3516 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3517 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 57, __pyx_L7_error)
3518 __Pyx_GOTREF(__pyx_t_4);
3519 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3520 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3529 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nr);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 58, __pyx_L7_error)
3530 __Pyx_GOTREF(__pyx_t_4);
3531 __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_4);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 58, __pyx_L7_error)
3532 __Pyx_GOTREF(__pyx_t_2);
3533 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3534 if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
3535 __pyx_t_4 = __pyx_t_2; __Pyx_INCREF(__pyx_t_4); __pyx_t_12 = 0;
3538 __pyx_t_12 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_2);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 58, __pyx_L7_error)
3539 __Pyx_GOTREF(__pyx_t_4);
3540 __pyx_t_13 = Py_TYPE(__pyx_t_4)->tp_iternext;
if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 58, __pyx_L7_error)
3542 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3544 if (likely(!__pyx_t_13)) {
3545 if (likely(PyList_CheckExact(__pyx_t_4))) {
3546 if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_4))
break;
3547 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3548 __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_12); __Pyx_INCREF(__pyx_t_2); __pyx_t_12++;
if (unlikely(0 < 0)) __PYX_ERR(0, 58, __pyx_L7_error)
3550 __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_12); __pyx_t_12++;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 58, __pyx_L7_error)
3551 __Pyx_GOTREF(__pyx_t_2);
3554 if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_4))
break;
3555 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3556 __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_12); __Pyx_INCREF(__pyx_t_2); __pyx_t_12++;
if (unlikely(0 < 0)) __PYX_ERR(0, 58, __pyx_L7_error)
3558 __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_12); __pyx_t_12++;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 58, __pyx_L7_error)
3559 __Pyx_GOTREF(__pyx_t_2);
3563 __pyx_t_2 = __pyx_t_13(__pyx_t_4);
3564 if (unlikely(!__pyx_t_2)) {
3565 PyObject* exc_type = PyErr_Occurred();
3567 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
3568 else __PYX_ERR(0, 58, __pyx_L7_error)
3572 __Pyx_GOTREF(__pyx_t_2);
3574 __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
3584 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rowptr);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 59, __pyx_L7_error)
3585 __Pyx_GOTREF(__pyx_t_2);
3586 __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_i);
if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 59, __pyx_L7_error)
3587 __Pyx_GOTREF(__pyx_t_11);
3588 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3589 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rowptr);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 59, __pyx_L7_error)
3590 __Pyx_GOTREF(__pyx_t_2);
3591 __pyx_t_10 = __Pyx_PyInt_AddObjC(__pyx_v_i, __pyx_int_1, 1, 0, 0);
if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 59, __pyx_L7_error)
3592 __Pyx_GOTREF(__pyx_t_10);
3593 __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_10);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 59, __pyx_L7_error)
3594 __Pyx_GOTREF(__pyx_t_5);
3595 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3596 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3597 __pyx_t_10 = PyTuple_New(2);
if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 59, __pyx_L7_error)
3598 __Pyx_GOTREF(__pyx_t_10);
3599 __Pyx_GIVEREF(__pyx_t_11);
3600 PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_11);
3601 __Pyx_GIVEREF(__pyx_t_5);
3602 PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_5);
3605 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_10, NULL);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 59, __pyx_L7_error)
3606 __Pyx_GOTREF(__pyx_t_5);
3607 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3608 if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) {
3609 __pyx_t_10 = __pyx_t_5; __Pyx_INCREF(__pyx_t_10); __pyx_t_14 = 0;
3612 __pyx_t_14 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_5);
if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 59, __pyx_L7_error)
3613 __Pyx_GOTREF(__pyx_t_10);
3614 __pyx_t_15 = Py_TYPE(__pyx_t_10)->tp_iternext;
if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 59, __pyx_L7_error)
3616 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3618 if (likely(!__pyx_t_15)) {
3619 if (likely(PyList_CheckExact(__pyx_t_10))) {
3620 if (__pyx_t_14 >= PyList_GET_SIZE(__pyx_t_10))
break;
3621 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3622 __pyx_t_5 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_14); __Pyx_INCREF(__pyx_t_5); __pyx_t_14++;
if (unlikely(0 < 0)) __PYX_ERR(0, 59, __pyx_L7_error)
3624 __pyx_t_5 = PySequence_ITEM(__pyx_t_10, __pyx_t_14); __pyx_t_14++;
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 59, __pyx_L7_error)
3625 __Pyx_GOTREF(__pyx_t_5);
3628 if (__pyx_t_14 >= PyTuple_GET_SIZE(__pyx_t_10))
break;
3629 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3630 __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_14); __Pyx_INCREF(__pyx_t_5); __pyx_t_14++;
if (unlikely(0 < 0)) __PYX_ERR(0, 59, __pyx_L7_error)
3632 __pyx_t_5 = PySequence_ITEM(__pyx_t_10, __pyx_t_14); __pyx_t_14++;
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 59, __pyx_L7_error)
3633 __Pyx_GOTREF(__pyx_t_5);
3637 __pyx_t_5 = __pyx_t_15(__pyx_t_10);
3638 if (unlikely(!__pyx_t_5)) {
3639 PyObject* exc_type = PyErr_Occurred();
3641 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
3642 else __PYX_ERR(0, 59, __pyx_L7_error)
3646 __Pyx_GOTREF(__pyx_t_5);
3648 __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_5);
3658 __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_output_file, __pyx_n_s_write);
if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 60, __pyx_L7_error)
3659 __Pyx_GOTREF(__pyx_t_11);
3660 __pyx_t_2 = PyNumber_Add(__pyx_v_i, __pyx_v_base);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 60, __pyx_L7_error)
3661 __Pyx_GOTREF(__pyx_t_2);
3662 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_colind);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L7_error)
3663 __Pyx_GOTREF(__pyx_t_1);
3664 __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_k);
if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 60, __pyx_L7_error)
3665 __Pyx_GOTREF(__pyx_t_9);
3666 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3667 __pyx_t_1 = PyNumber_Add(__pyx_t_9, __pyx_v_base);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L7_error)
3668 __Pyx_GOTREF(__pyx_t_1);
3669 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3670 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nzvals);
if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 60, __pyx_L7_error)
3671 __Pyx_GOTREF(__pyx_t_9);
3672 __pyx_t_16 = __Pyx_PyObject_GetItem(__pyx_t_9, __pyx_v_k);
if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 60, __pyx_L7_error)
3673 __Pyx_GOTREF(__pyx_t_16);
3674 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3675 __pyx_t_9 = PyTuple_New(3);
if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 60, __pyx_L7_error)
3676 __Pyx_GOTREF(__pyx_t_9);
3677 __Pyx_GIVEREF(__pyx_t_2);
3678 PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
3679 __Pyx_GIVEREF(__pyx_t_1);
3680 PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_1);
3681 __Pyx_GIVEREF(__pyx_t_16);
3682 PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_16);
3686 __pyx_t_16 = __Pyx_PyString_Format(__pyx_kp_s_d_d_13_8e, __pyx_t_9);
if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 60, __pyx_L7_error)
3687 __Pyx_GOTREF(__pyx_t_16);
3688 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3690 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
3691 __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_11);
3692 if (likely(__pyx_t_9)) {
3693 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_11);
3694 __Pyx_INCREF(__pyx_t_9);
3695 __Pyx_INCREF(
function);
3696 __Pyx_DECREF_SET(__pyx_t_11,
function);
3699 __pyx_t_5 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_9, __pyx_t_16) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_16);
3700 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
3701 __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
3702 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 60, __pyx_L7_error)
3703 __Pyx_GOTREF(__pyx_t_5);
3704 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3705 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3715 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3725 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3735 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
3736 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
3737 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
3738 goto __pyx_L12_try_end;
3740 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
3741 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
3742 __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
3743 __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
3744 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
3745 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
3746 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
3747 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
3749 __Pyx_AddTraceback(
"superluWrappers.SparseMatrix.fwrite", __pyx_clineno, __pyx_lineno, __pyx_filename);
3750 if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_10, &__pyx_t_5) < 0) __PYX_ERR(0, 56, __pyx_L9_except_error)
3751 __Pyx_GOTREF(__pyx_t_4);
3752 __Pyx_GOTREF(__pyx_t_10);
3753 __Pyx_GOTREF(__pyx_t_5);
3754 __pyx_t_11 = PyTuple_Pack(3, __pyx_t_4, __pyx_t_10, __pyx_t_5);
if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 56, __pyx_L9_except_error)
3755 __Pyx_GOTREF(__pyx_t_11);
3756 __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_11, NULL);
3757 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3758 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3759 if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 56, __pyx_L9_except_error)
3760 __Pyx_GOTREF(__pyx_t_17);
3761 __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_17);
3762 __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
3763 if (__pyx_t_18 < 0) __PYX_ERR(0, 56, __pyx_L9_except_error)
3764 __pyx_t_19 = ((!(__pyx_t_18 != 0)) != 0);
3766 __Pyx_GIVEREF(__pyx_t_4);
3767 __Pyx_GIVEREF(__pyx_t_10);
3768 __Pyx_XGIVEREF(__pyx_t_5);
3769 __Pyx_ErrRestoreWithState(__pyx_t_4, __pyx_t_10, __pyx_t_5);
3770 __pyx_t_4 = 0; __pyx_t_10 = 0; __pyx_t_5 = 0;
3771 __PYX_ERR(0, 56, __pyx_L9_except_error)
3773 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
3774 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
3775 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
3776 goto __pyx_L8_exception_handled;
3778 __pyx_L9_except_error:;
3779 __Pyx_XGIVEREF(__pyx_t_6);
3780 __Pyx_XGIVEREF(__pyx_t_7);
3781 __Pyx_XGIVEREF(__pyx_t_8);
3782 __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
3783 goto __pyx_L1_error;
3784 __pyx_L8_exception_handled:;
3785 __Pyx_XGIVEREF(__pyx_t_6);
3786 __Pyx_XGIVEREF(__pyx_t_7);
3787 __Pyx_XGIVEREF(__pyx_t_8);
3788 __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
3795 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple_, NULL);
3796 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3797 if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 56, __pyx_L1_error)
3798 __Pyx_GOTREF(__pyx_t_8);
3799 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3807 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3808 goto __pyx_L1_error;
3821 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3824 __Pyx_XDECREF(__pyx_t_1);
3825 __Pyx_XDECREF(__pyx_t_2);
3826 __Pyx_XDECREF(__pyx_t_4);
3827 __Pyx_XDECREF(__pyx_t_5);
3828 __Pyx_XDECREF(__pyx_t_9);
3829 __Pyx_XDECREF(__pyx_t_10);
3830 __Pyx_XDECREF(__pyx_t_11);
3831 __Pyx_XDECREF(__pyx_t_16);
3832 __Pyx_AddTraceback(
"superluWrappers.SparseMatrix.fwrite", __pyx_clineno, __pyx_lineno, __pyx_filename);
3835 __Pyx_XDECREF(__pyx_v_output_file);
3836 __Pyx_XDECREF(__pyx_v_i);
3837 __Pyx_XDECREF(__pyx_v_k);
3838 __Pyx_XGIVEREF(__pyx_r);
3839 __Pyx_RefNannyFinishContext();
3852 static PyObject *__pyx_pw_15superluWrappers_12SparseMatrix_7getCSRrepresentation(PyObject *__pyx_self, PyObject *__pyx_v_self);
3853 static char __pyx_doc_15superluWrappers_12SparseMatrix_6getCSRrepresentation[] =
" Get the CSR representation of the sparse matrix.\n\n Returns\n -------\n csr_data : tuple of nparray\n (rowptr, colptr, vals)\n ";
3854 static PyMethodDef __pyx_mdef_15superluWrappers_12SparseMatrix_7getCSRrepresentation = {
"getCSRrepresentation", (PyCFunction)__pyx_pw_15superluWrappers_12SparseMatrix_7getCSRrepresentation, METH_O, __pyx_doc_15superluWrappers_12SparseMatrix_6getCSRrepresentation};
3855 static PyObject *__pyx_pw_15superluWrappers_12SparseMatrix_7getCSRrepresentation(PyObject *__pyx_self, PyObject *__pyx_v_self) {
3856 PyObject *__pyx_r = 0;
3857 __Pyx_RefNannyDeclarations
3858 __Pyx_RefNannySetupContext(
"getCSRrepresentation (wrapper)", 0);
3859 __pyx_r = __pyx_pf_15superluWrappers_12SparseMatrix_6getCSRrepresentation(__pyx_self, ((PyObject *)__pyx_v_self));
3862 __Pyx_RefNannyFinishContext();
3866 static PyObject *__pyx_pf_15superluWrappers_12SparseMatrix_6getCSRrepresentation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
3867 PyObject *__pyx_r = NULL;
3868 __Pyx_RefNannyDeclarations
3869 PyObject *__pyx_t_1 = NULL;
3870 PyObject *__pyx_t_2 = NULL;
3871 PyObject *__pyx_t_3 = NULL;
3872 PyObject *__pyx_t_4 = NULL;
3873 int __pyx_lineno = 0;
3874 const char *__pyx_filename = NULL;
3875 int __pyx_clineno = 0;
3876 __Pyx_RefNannySetupContext(
"getCSRrepresentation", 0);
3885 __Pyx_XDECREF(__pyx_r);
3886 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rowptr);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error)
3887 __Pyx_GOTREF(__pyx_t_1);
3888 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_colind);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error)
3889 __Pyx_GOTREF(__pyx_t_2);
3890 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nzvals);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 70, __pyx_L1_error)
3891 __Pyx_GOTREF(__pyx_t_3);
3892 __pyx_t_4 = PyTuple_New(3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 70, __pyx_L1_error)
3893 __Pyx_GOTREF(__pyx_t_4);
3894 __Pyx_GIVEREF(__pyx_t_1);
3895 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
3896 __Pyx_GIVEREF(__pyx_t_2);
3897 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
3898 __Pyx_GIVEREF(__pyx_t_3);
3899 PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
3903 __pyx_r = __pyx_t_4;
3917 __Pyx_XDECREF(__pyx_t_1);
3918 __Pyx_XDECREF(__pyx_t_2);
3919 __Pyx_XDECREF(__pyx_t_3);
3920 __Pyx_XDECREF(__pyx_t_4);
3921 __Pyx_AddTraceback(
"superluWrappers.SparseMatrix.getCSRrepresentation", __pyx_clineno, __pyx_lineno, __pyx_filename);
3924 __Pyx_XGIVEREF(__pyx_r);
3925 __Pyx_RefNannyFinishContext();
3938 static PyObject *__pyx_pw_15superluWrappers_12SparseMatrix_9getSubMatCSRrepresentation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
3939 static char __pyx_doc_15superluWrappers_12SparseMatrix_8getSubMatCSRrepresentation[] =
" Get the CSR representation for a submatrix.\n\n Arguments\n ---------\n range_start : int\n range_end : int\n\n Returns\n -------\n csr_data : tuple of nparray\n (rowptr, colind, nzvals)\n ";
3940 static PyMethodDef __pyx_mdef_15superluWrappers_12SparseMatrix_9getSubMatCSRrepresentation = {
"getSubMatCSRrepresentation", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_15superluWrappers_12SparseMatrix_9getSubMatCSRrepresentation, METH_VARARGS|METH_KEYWORDS, __pyx_doc_15superluWrappers_12SparseMatrix_8getSubMatCSRrepresentation};
3941 static PyObject *__pyx_pw_15superluWrappers_12SparseMatrix_9getSubMatCSRrepresentation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3942 PyObject *__pyx_v_self = 0;
3943 PyObject *__pyx_v_range_start = 0;
3944 PyObject *__pyx_v_range_end = 0;
3945 int __pyx_lineno = 0;
3946 const char *__pyx_filename = NULL;
3947 int __pyx_clineno = 0;
3948 PyObject *__pyx_r = 0;
3949 __Pyx_RefNannyDeclarations
3950 __Pyx_RefNannySetupContext(
"getSubMatCSRrepresentation (wrapper)", 0);
3952 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_range_start,&__pyx_n_s_range_end,0};
3953 PyObject* values[3] = {0,0,0};
3954 if (unlikely(__pyx_kwds)) {
3956 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3958 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3960 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3962 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3965 default:
goto __pyx_L5_argtuple_error;
3967 kw_args = PyDict_Size(__pyx_kwds);
3970 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
3971 else goto __pyx_L5_argtuple_error;
3974 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_range_start)) != 0)) kw_args--;
3976 __Pyx_RaiseArgtupleInvalid(
"getSubMatCSRrepresentation", 1, 3, 3, 1); __PYX_ERR(0, 72, __pyx_L3_error)
3980 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_range_end)) != 0)) kw_args--;
3982 __Pyx_RaiseArgtupleInvalid(
"getSubMatCSRrepresentation", 1, 3, 3, 2); __PYX_ERR(0, 72, __pyx_L3_error)
3985 if (unlikely(kw_args > 0)) {
3986 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"getSubMatCSRrepresentation") < 0)) __PYX_ERR(0, 72, __pyx_L3_error)
3988 }
else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
3989 goto __pyx_L5_argtuple_error;
3991 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3992 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3993 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3995 __pyx_v_self = values[0];
3996 __pyx_v_range_start = values[1];
3997 __pyx_v_range_end = values[2];
3999 goto __pyx_L4_argument_unpacking_done;
4000 __pyx_L5_argtuple_error:;
4001 __Pyx_RaiseArgtupleInvalid(
"getSubMatCSRrepresentation", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 72, __pyx_L3_error)
4003 __Pyx_AddTraceback(
"superluWrappers.SparseMatrix.getSubMatCSRrepresentation", __pyx_clineno, __pyx_lineno, __pyx_filename);
4004 __Pyx_RefNannyFinishContext();
4006 __pyx_L4_argument_unpacking_done:;
4007 __pyx_r = __pyx_pf_15superluWrappers_12SparseMatrix_8getSubMatCSRrepresentation(__pyx_self, __pyx_v_self, __pyx_v_range_start, __pyx_v_range_end);
4010 __Pyx_RefNannyFinishContext();
4014 static PyObject *__pyx_pf_15superluWrappers_12SparseMatrix_8getSubMatCSRrepresentation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_range_start, PyObject *__pyx_v_range_end) {
4015 PyObject *__pyx_v__rows = NULL;
4016 PyObject *__pyx_v_nnz = NULL;
4017 PyObject *__pyx_v_rowptr = NULL;
4018 PyObject *__pyx_v_colind = NULL;
4019 PyObject *__pyx_v_nzvals = NULL;
4020 PyObject *__pyx_r = NULL;
4021 __Pyx_RefNannyDeclarations
4022 PyObject *__pyx_t_1 = NULL;
4024 PyObject *__pyx_t_3 = NULL;
4025 PyObject *__pyx_t_4 = NULL;
4026 PyObject *__pyx_t_5 = NULL;
4027 int __pyx_lineno = 0;
4028 const char *__pyx_filename = NULL;
4029 int __pyx_clineno = 0;
4030 __Pyx_RefNannySetupContext(
"getSubMatCSRrepresentation", 0);
4039 #ifndef CYTHON_WITHOUT_ASSERTIONS
4040 if (unlikely(!Py_OptimizeFlag)) {
4041 __pyx_t_1 = PyObject_RichCompare(__pyx_v_range_start, __pyx_int_0, Py_GE); __Pyx_XGOTREF(__pyx_t_1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 87, __pyx_L1_error)
4042 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1);
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 87, __pyx_L1_error)
4043 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4044 if (unlikely(!__pyx_t_2)) {
4045 PyErr_SetNone(PyExc_AssertionError);
4046 __PYX_ERR(0, 87, __pyx_L1_error)
4050 #ifndef CYTHON_WITHOUT_ASSERTIONS
4051 if (unlikely(!Py_OptimizeFlag)) {
4052 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nr);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 87, __pyx_L1_error)
4053 __Pyx_GOTREF(__pyx_t_1);
4054 __pyx_t_3 = PyObject_RichCompare(__pyx_v_range_end, __pyx_t_1, Py_LE); __Pyx_XGOTREF(__pyx_t_3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 87, __pyx_L1_error)
4055 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4056 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3);
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 87, __pyx_L1_error)
4057 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4058 if (unlikely(!__pyx_t_2)) {
4059 PyErr_SetNone(PyExc_AssertionError);
4060 __PYX_ERR(0, 87, __pyx_L1_error)
4072 #ifndef CYTHON_WITHOUT_ASSERTIONS
4073 if (unlikely(!Py_OptimizeFlag)) {
4074 __pyx_t_3 = PyObject_RichCompare(__pyx_v_range_end, __pyx_v_range_start, Py_GT); __Pyx_XGOTREF(__pyx_t_3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 88, __pyx_L1_error)
4075 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3);
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 88, __pyx_L1_error)
4076 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4077 if (unlikely(!__pyx_t_2)) {
4078 PyErr_SetNone(PyExc_AssertionError);
4079 __PYX_ERR(0, 88, __pyx_L1_error)
4091 __pyx_t_3 = PyNumber_Subtract(__pyx_v_range_end, __pyx_v_range_start);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 89, __pyx_L1_error)
4092 __Pyx_GOTREF(__pyx_t_3);
4093 __pyx_v__rows = __pyx_t_3;
4103 #ifndef CYTHON_WITHOUT_ASSERTIONS
4104 if (unlikely(!Py_OptimizeFlag)) {
4105 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nr);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 90, __pyx_L1_error)
4106 __Pyx_GOTREF(__pyx_t_3);
4107 __pyx_t_1 = PyObject_RichCompare(__pyx_v__rows, __pyx_t_3, Py_LE); __Pyx_XGOTREF(__pyx_t_1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error)
4108 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4109 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1);
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 90, __pyx_L1_error)
4110 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4111 if (unlikely(!__pyx_t_2)) {
4112 PyErr_SetNone(PyExc_AssertionError);
4113 __PYX_ERR(0, 90, __pyx_L1_error)
4125 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rowptr);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error)
4126 __Pyx_GOTREF(__pyx_t_1);
4127 __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_range_end);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 92, __pyx_L1_error)
4128 __Pyx_GOTREF(__pyx_t_3);
4129 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4130 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rowptr);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error)
4131 __Pyx_GOTREF(__pyx_t_1);
4132 __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_range_start);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 92, __pyx_L1_error)
4133 __Pyx_GOTREF(__pyx_t_4);
4134 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4135 __pyx_t_1 = PyNumber_Subtract(__pyx_t_3, __pyx_t_4);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error)
4136 __Pyx_GOTREF(__pyx_t_1);
4137 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4138 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4139 __pyx_v_nnz = __pyx_t_1;
4149 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rowptr);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 94, __pyx_L1_error)
4150 __Pyx_GOTREF(__pyx_t_1);
4151 __pyx_t_4 = PyNumber_Add(__pyx_v_range_start, __pyx_v__rows);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 94, __pyx_L1_error)
4152 __Pyx_GOTREF(__pyx_t_4);
4153 __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_4, __pyx_int_1, 1, 0, 0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 94, __pyx_L1_error)
4154 __Pyx_GOTREF(__pyx_t_3);
4155 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4156 __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, 0, &__pyx_v_range_start, &__pyx_t_3, NULL, 0, 0, 0);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 94, __pyx_L1_error)
4157 __Pyx_GOTREF(__pyx_t_4);
4158 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4159 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4160 __pyx_v_rowptr = __pyx_t_4;
4170 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_colind);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 95, __pyx_L1_error)
4171 __Pyx_GOTREF(__pyx_t_4);
4172 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rowptr);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 95, __pyx_L1_error)
4173 __Pyx_GOTREF(__pyx_t_3);
4174 __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_v_range_start);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 95, __pyx_L1_error)
4175 __Pyx_GOTREF(__pyx_t_1);
4176 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4177 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rowptr);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 95, __pyx_L1_error)
4178 __Pyx_GOTREF(__pyx_t_3);
4179 __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_v_range_start);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 95, __pyx_L1_error)
4180 __Pyx_GOTREF(__pyx_t_5);
4181 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4182 __pyx_t_3 = PyNumber_Add(__pyx_t_5, __pyx_v_nnz);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 95, __pyx_L1_error)
4183 __Pyx_GOTREF(__pyx_t_3);
4184 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4185 __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_t_4, 0, 0, &__pyx_t_1, &__pyx_t_3, NULL, 0, 0, 0);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 95, __pyx_L1_error)
4186 __Pyx_GOTREF(__pyx_t_5);
4187 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4188 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4189 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4190 __pyx_v_colind = __pyx_t_5;
4200 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nzvals);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 96, __pyx_L1_error)
4201 __Pyx_GOTREF(__pyx_t_5);
4202 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rowptr);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 96, __pyx_L1_error)
4203 __Pyx_GOTREF(__pyx_t_3);
4204 __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_v_range_start);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error)
4205 __Pyx_GOTREF(__pyx_t_1);
4206 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4207 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rowptr);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 96, __pyx_L1_error)
4208 __Pyx_GOTREF(__pyx_t_3);
4209 __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_v_range_start);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 96, __pyx_L1_error)
4210 __Pyx_GOTREF(__pyx_t_4);
4211 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4212 __pyx_t_3 = PyNumber_Add(__pyx_t_4, __pyx_v_nnz);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 96, __pyx_L1_error)
4213 __Pyx_GOTREF(__pyx_t_3);
4214 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4215 __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_t_5, 0, 0, &__pyx_t_1, &__pyx_t_3, NULL, 0, 0, 0);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 96, __pyx_L1_error)
4216 __Pyx_GOTREF(__pyx_t_4);
4217 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4218 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4219 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4220 __pyx_v_nzvals = __pyx_t_4;
4230 __Pyx_XDECREF(__pyx_r);
4231 __pyx_t_4 = PyTuple_New(3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 98, __pyx_L1_error)
4232 __Pyx_GOTREF(__pyx_t_4);
4233 __Pyx_INCREF(__pyx_v_rowptr);
4234 __Pyx_GIVEREF(__pyx_v_rowptr);
4235 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_rowptr);
4236 __Pyx_INCREF(__pyx_v_colind);
4237 __Pyx_GIVEREF(__pyx_v_colind);
4238 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_colind);
4239 __Pyx_INCREF(__pyx_v_nzvals);
4240 __Pyx_GIVEREF(__pyx_v_nzvals);
4241 PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_nzvals);
4242 __pyx_r = __pyx_t_4;
4256 __Pyx_XDECREF(__pyx_t_1);
4257 __Pyx_XDECREF(__pyx_t_3);
4258 __Pyx_XDECREF(__pyx_t_4);
4259 __Pyx_XDECREF(__pyx_t_5);
4260 __Pyx_AddTraceback(
"superluWrappers.SparseMatrix.getSubMatCSRrepresentation", __pyx_clineno, __pyx_lineno, __pyx_filename);
4263 __Pyx_XDECREF(__pyx_v__rows);
4264 __Pyx_XDECREF(__pyx_v_nnz);
4265 __Pyx_XDECREF(__pyx_v_rowptr);
4266 __Pyx_XDECREF(__pyx_v_colind);
4267 __Pyx_XDECREF(__pyx_v_nzvals);
4268 __Pyx_XGIVEREF(__pyx_r);
4269 __Pyx_RefNannyFinishContext();
4282 static int __pyx_pw_15superluWrappers_13cSparseMatrix_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
4283 static int __pyx_pw_15superluWrappers_13cSparseMatrix_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4287 __Pyx_memviewslice __pyx_v_nzval = { 0, 0, { 0 }, { 0 }, { 0 } };
4288 __Pyx_memviewslice __pyx_v_colind = { 0, 0, { 0 }, { 0 }, { 0 } };
4289 __Pyx_memviewslice __pyx_v_rowptr = { 0, 0, { 0 }, { 0 }, { 0 } };
4290 int __pyx_lineno = 0;
4291 const char *__pyx_filename = NULL;
4292 int __pyx_clineno = 0;
4294 __Pyx_RefNannyDeclarations
4295 __Pyx_RefNannySetupContext(
"__cinit__ (wrapper)", 0);
4297 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nr,&__pyx_n_s_nc,&__pyx_n_s_nnz,&__pyx_n_s_nzval,&__pyx_n_s_colind,&__pyx_n_s_rowptr,0};
4298 PyObject* values[6] = {0,0,0,0,0,0};
4299 if (unlikely(__pyx_kwds)) {
4301 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4303 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
4305 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4307 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4309 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4311 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4313 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4316 default:
goto __pyx_L5_argtuple_error;
4318 kw_args = PyDict_Size(__pyx_kwds);
4321 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nr)) != 0)) kw_args--;
4322 else goto __pyx_L5_argtuple_error;
4325 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nc)) != 0)) kw_args--;
4327 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 1, 6, 6, 1); __PYX_ERR(0, 102, __pyx_L3_error)
4331 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nnz)) != 0)) kw_args--;
4333 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 1, 6, 6, 2); __PYX_ERR(0, 102, __pyx_L3_error)
4337 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nzval)) != 0)) kw_args--;
4339 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 1, 6, 6, 3); __PYX_ERR(0, 102, __pyx_L3_error)
4343 if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_colind)) != 0)) kw_args--;
4345 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 1, 6, 6, 4); __PYX_ERR(0, 102, __pyx_L3_error)
4349 if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rowptr)) != 0)) kw_args--;
4351 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 1, 6, 6, 5); __PYX_ERR(0, 102, __pyx_L3_error)
4354 if (unlikely(kw_args > 0)) {
4355 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__cinit__") < 0)) __PYX_ERR(0, 102, __pyx_L3_error)
4357 }
else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
4358 goto __pyx_L5_argtuple_error;
4360 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4361 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4362 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4363 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4364 values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4365 values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
4367 __pyx_v_nr = __Pyx_PyInt_As_int(values[0]);
if (unlikely((__pyx_v_nr == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 103, __pyx_L3_error)
4368 __pyx_v_nc = __Pyx_PyInt_As_int(values[1]);
if (unlikely((__pyx_v_nc == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L3_error)
4369 __pyx_v_nnz = __Pyx_PyInt_As_int(values[2]);
if (unlikely((__pyx_v_nnz == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 105, __pyx_L3_error)
4370 __pyx_v_nzval = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(values[3], PyBUF_WRITABLE);
if (unlikely(!__pyx_v_nzval.memview)) __PYX_ERR(0, 106, __pyx_L3_error)
4371 __pyx_v_colind = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int32_t(values[4], PyBUF_WRITABLE);
if (unlikely(!__pyx_v_colind.memview)) __PYX_ERR(0, 107, __pyx_L3_error)
4372 __pyx_v_rowptr = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int32_t(values[5], PyBUF_WRITABLE);
if (unlikely(!__pyx_v_rowptr.memview)) __PYX_ERR(0, 108, __pyx_L3_error)
4374 goto __pyx_L4_argument_unpacking_done;
4375 __pyx_L5_argtuple_error:;
4376 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 102, __pyx_L3_error)
4378 __Pyx_AddTraceback(
"superluWrappers.cSparseMatrix.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4379 __Pyx_RefNannyFinishContext();
4381 __pyx_L4_argument_unpacking_done:;
4382 __pyx_r = __pyx_pf_15superluWrappers_13cSparseMatrix___cinit__(((
struct __pyx_obj_15superluWrappers_cSparseMatrix *)__pyx_v_self), __pyx_v_nr, __pyx_v_nc, __pyx_v_nnz, __pyx_v_nzval, __pyx_v_colind, __pyx_v_rowptr);
4385 __Pyx_RefNannyFinishContext();
4389 static int __pyx_pf_15superluWrappers_13cSparseMatrix___cinit__(
struct __pyx_obj_15superluWrappers_cSparseMatrix *__pyx_v_self,
int __pyx_v_nr,
int __pyx_v_nc,
int __pyx_v_nnz, __Pyx_memviewslice __pyx_v_nzval, __Pyx_memviewslice __pyx_v_colind, __Pyx_memviewslice __pyx_v_rowptr) {
4391 __Pyx_RefNannyDeclarations
4392 Py_ssize_t __pyx_t_1;
4393 __Pyx_RefNannySetupContext(
"__cinit__", 0);
4402 (__pyx_v_self->dim[0]) = __pyx_v_nr;
4403 (__pyx_v_self->dim[1]) = __pyx_v_nc;
4412 __pyx_v_self->A.nnz = __pyx_v_nnz;
4422 __pyx_v_self->A.nzval = (&(*((__pyx_t_5numpy_float64_t *) ( (__pyx_v_nzval.data + __pyx_t_1 * __pyx_v_nzval.strides[0]) ))));
4432 __pyx_v_self->A.colind = (&(*((__pyx_t_5numpy_int32_t *) ( (__pyx_v_colind.data + __pyx_t_1 * __pyx_v_colind.strides[0]) ))));
4442 __pyx_v_self->A.rowptr = (&(*((__pyx_t_5numpy_int32_t *) ( (__pyx_v_rowptr.data + __pyx_t_1 * __pyx_v_rowptr.strides[0]) ))));
4454 __PYX_XDEC_MEMVIEW(&__pyx_v_nzval, 1);
4455 __PYX_XDEC_MEMVIEW(&__pyx_v_colind, 1);
4456 __PYX_XDEC_MEMVIEW(&__pyx_v_rowptr, 1);
4457 __Pyx_RefNannyFinishContext();
4468 static PyObject *__pyx_pw_15superluWrappers_13cSparseMatrix_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
4469 static PyObject *__pyx_pw_15superluWrappers_13cSparseMatrix_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
4470 PyObject *__pyx_r = 0;
4471 __Pyx_RefNannyDeclarations
4472 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
4473 __pyx_r = __pyx_pf_15superluWrappers_13cSparseMatrix_2__reduce_cython__(((
struct __pyx_obj_15superluWrappers_cSparseMatrix *)__pyx_v_self));
4476 __Pyx_RefNannyFinishContext();
4480 static PyObject *__pyx_pf_15superluWrappers_13cSparseMatrix_2__reduce_cython__(CYTHON_UNUSED
struct __pyx_obj_15superluWrappers_cSparseMatrix *__pyx_v_self) {
4481 PyObject *__pyx_r = NULL;
4482 __Pyx_RefNannyDeclarations
4483 PyObject *__pyx_t_1 = NULL;
4484 int __pyx_lineno = 0;
4485 const char *__pyx_filename = NULL;
4486 int __pyx_clineno = 0;
4487 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
4495 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
4496 __Pyx_GOTREF(__pyx_t_1);
4497 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
4498 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4499 __PYX_ERR(1, 2, __pyx_L1_error)
4509 __Pyx_XDECREF(__pyx_t_1);
4510 __Pyx_AddTraceback(
"superluWrappers.cSparseMatrix.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4512 __Pyx_XGIVEREF(__pyx_r);
4513 __Pyx_RefNannyFinishContext();
4525 static PyObject *__pyx_pw_15superluWrappers_13cSparseMatrix_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
4526 static PyObject *__pyx_pw_15superluWrappers_13cSparseMatrix_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
4527 PyObject *__pyx_r = 0;
4528 __Pyx_RefNannyDeclarations
4529 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
4530 __pyx_r = __pyx_pf_15superluWrappers_13cSparseMatrix_4__setstate_cython__(((
struct __pyx_obj_15superluWrappers_cSparseMatrix *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
4533 __Pyx_RefNannyFinishContext();
4537 static PyObject *__pyx_pf_15superluWrappers_13cSparseMatrix_4__setstate_cython__(CYTHON_UNUSED
struct __pyx_obj_15superluWrappers_cSparseMatrix *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
4538 PyObject *__pyx_r = NULL;
4539 __Pyx_RefNannyDeclarations
4540 PyObject *__pyx_t_1 = NULL;
4541 int __pyx_lineno = 0;
4542 const char *__pyx_filename = NULL;
4543 int __pyx_clineno = 0;
4544 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
4551 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
4552 __Pyx_GOTREF(__pyx_t_1);
4553 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
4554 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4555 __PYX_ERR(1, 4, __pyx_L1_error)
4566 __Pyx_XDECREF(__pyx_t_1);
4567 __Pyx_AddTraceback(
"superluWrappers.cSparseMatrix.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4569 __Pyx_XGIVEREF(__pyx_r);
4570 __Pyx_RefNannyFinishContext();
4582 static void __pyx_f_15superluWrappers_SparseMatrix_matvec(
struct __pyx_obj_15superluWrappers_cSparseMatrix *__pyx_v_sm, __Pyx_memviewslice __pyx_v_xp, __Pyx_memviewslice __pyx_v_yp) {
4583 __pyx_t_5numpy_float64_t __pyx_v_tmp;
4586 __Pyx_RefNannyDeclarations
4587 __pyx_t_5numpy_int32_t __pyx_t_1;
4588 __pyx_t_5numpy_int32_t __pyx_t_2;
4590 __pyx_t_5numpy_int32_t __pyx_t_4;
4591 __pyx_t_5numpy_int32_t __pyx_t_5;
4593 Py_ssize_t __pyx_t_7;
4594 __Pyx_RefNannySetupContext(
"SparseMatrix_matvec", 0);
4612 __pyx_t_1 = (__pyx_v_sm->dim[0]);
4613 __pyx_t_2 = __pyx_t_1;
4614 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
4615 __pyx_v_i = __pyx_t_3;
4633 __pyx_t_4 = (__pyx_v_sm->A.rowptr[(__pyx_v_i + 1)]);
4634 __pyx_t_5 = __pyx_t_4;
4635 for (__pyx_t_6 = (__pyx_v_sm->A.rowptr[__pyx_v_i]); __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
4636 __pyx_v_k = __pyx_t_6;
4645 __pyx_t_7 = (__pyx_v_sm->A.colind[__pyx_v_k]);
4646 __pyx_v_tmp = (__pyx_v_tmp + ((__pyx_v_sm->A.nzval[__pyx_v_k]) * (*((__pyx_t_5numpy_float64_t *) ( (__pyx_v_xp.data + __pyx_t_7 * __pyx_v_xp.strides[0]) )))));
4656 __pyx_t_7 = __pyx_v_i;
4657 *((__pyx_t_5numpy_float64_t *) ( (__pyx_v_yp.data + __pyx_t_7 * __pyx_v_yp.strides[0]) )) = __pyx_v_tmp;
4669 __Pyx_RefNannyFinishContext();
4681 static int __pyx_pw_15superluWrappers_12SparseFactor_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
4682 static char __pyx_doc_15superluWrappers_12SparseFactor___init__[] =
"\n Arguments\n ---------\n dim : int\n Dimension of the sparse factor.\n ";
4683 #if CYTHON_COMPILING_IN_CPYTHON
4684 struct wrapperbase __pyx_wrapperbase_15superluWrappers_12SparseFactor___init__;
4686 static int __pyx_pw_15superluWrappers_12SparseFactor_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4687 PyObject *__pyx_v_dim = 0;
4688 int __pyx_lineno = 0;
4689 const char *__pyx_filename = NULL;
4690 int __pyx_clineno = 0;
4692 __Pyx_RefNannyDeclarations
4693 __Pyx_RefNannySetupContext(
"__init__ (wrapper)", 0);
4695 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dim,0};
4696 PyObject* values[1] = {0};
4697 if (unlikely(__pyx_kwds)) {
4699 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4701 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4704 default:
goto __pyx_L5_argtuple_error;
4706 kw_args = PyDict_Size(__pyx_kwds);
4709 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dim)) != 0)) kw_args--;
4710 else goto __pyx_L5_argtuple_error;
4712 if (unlikely(kw_args > 0)) {
4713 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__init__") < 0)) __PYX_ERR(0, 170, __pyx_L3_error)
4715 }
else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
4716 goto __pyx_L5_argtuple_error;
4718 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4720 __pyx_v_dim = values[0];
4722 goto __pyx_L4_argument_unpacking_done;
4723 __pyx_L5_argtuple_error:;
4724 __Pyx_RaiseArgtupleInvalid(
"__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 170, __pyx_L3_error)
4726 __Pyx_AddTraceback(
"superluWrappers.SparseFactor.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4727 __Pyx_RefNannyFinishContext();
4729 __pyx_L4_argument_unpacking_done:;
4730 __pyx_r = __pyx_pf_15superluWrappers_12SparseFactor___init__(((
struct __pyx_obj_15superluWrappers_SparseFactor *)__pyx_v_self), __pyx_v_dim);
4733 __Pyx_RefNannyFinishContext();
4737 static int __pyx_pf_15superluWrappers_12SparseFactor___init__(
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_self, PyObject *__pyx_v_dim) {
4739 __Pyx_RefNannyDeclarations
4740 PyObject *__pyx_t_1 = NULL;
4742 __pyx_t_5numpy_int32_t __pyx_t_3;
4743 PyObject *__pyx_t_4 = NULL;
4745 int __pyx_lineno = 0;
4746 const char *__pyx_filename = NULL;
4747 int __pyx_clineno = 0;
4748 __Pyx_RefNannySetupContext(
"__init__", 0);
4757 StatInit((&__pyx_v_self->stat));
4766 set_default_options((&__pyx_v_self->options));
4775 __pyx_t_1 = ((
struct __pyx_vtabstruct_15superluWrappers_SparseFactor *)__pyx_v_self->__pyx_vtab)->_set_mat_types(__pyx_v_self);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 179, __pyx_L1_error)
4776 __Pyx_GOTREF(__pyx_t_1);
4777 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4786 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_dim);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L1_error)
4787 __pyx_v_self->dim = __pyx_t_2;
4796 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_dim);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 181, __pyx_L1_error)
4797 __pyx_v_self->A.nrow = __pyx_t_2;
4798 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_dim);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 181, __pyx_L1_error)
4799 __pyx_v_self->A.ncol = __pyx_t_2;
4808 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_dim);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 182, __pyx_L1_error)
4809 __pyx_v_self->AC.nrow = __pyx_t_2;
4810 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_dim);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 182, __pyx_L1_error)
4811 __pyx_v_self->AC.ncol = __pyx_t_2;
4820 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_dim);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 183, __pyx_L1_error)
4821 __pyx_v_self->L.nrow = __pyx_t_2;
4822 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_dim);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 183, __pyx_L1_error)
4823 __pyx_v_self->L.ncol = __pyx_t_2;
4832 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_dim);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 184, __pyx_L1_error)
4833 __pyx_v_self->U.nrow = __pyx_t_2;
4834 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_dim);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 184, __pyx_L1_error)
4835 __pyx_v_self->U.ncol = __pyx_t_2;
4844 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_dim);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 185, __pyx_L1_error)
4845 __pyx_v_self->X.nrow = __pyx_t_2;
4846 __pyx_v_self->X.ncol = 1;
4855 __pyx_t_3 = __Pyx_PyInt_As_npy_int32(__pyx_v_dim);
if (unlikely((__pyx_t_3 == ((npy_int32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 186, __pyx_L1_error)
4856 __pyx_v_self->storeX.lda = __pyx_t_3;
4865 __pyx_v_self->use_same_perm_c = 0;
4874 __pyx_v_self->use_same_sparsity = 0;
4883 __pyx_t_1 = __Pyx_PyInt_FromSize_t((
sizeof(__pyx_t_5numpy_int32_t)));
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error)
4884 __Pyx_GOTREF(__pyx_t_1);
4885 __pyx_t_4 = PyNumber_Multiply(__pyx_v_dim, __pyx_t_1);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 189, __pyx_L1_error)
4886 __Pyx_GOTREF(__pyx_t_4);
4887 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4888 __pyx_t_5 = __Pyx_PyInt_As_size_t(__pyx_t_4);
if (unlikely((__pyx_t_5 == (
size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 189, __pyx_L1_error)
4889 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4890 __pyx_v_self->perm_c = ((
int *)malloc(__pyx_t_5));
4899 __pyx_t_4 = __Pyx_PyInt_FromSize_t((
sizeof(__pyx_t_5numpy_int32_t)));
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 190, __pyx_L1_error)
4900 __Pyx_GOTREF(__pyx_t_4);
4901 __pyx_t_1 = PyNumber_Multiply(__pyx_v_dim, __pyx_t_4);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error)
4902 __Pyx_GOTREF(__pyx_t_1);
4903 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4904 __pyx_t_5 = __Pyx_PyInt_As_size_t(__pyx_t_1);
if (unlikely((__pyx_t_5 == (
size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 190, __pyx_L1_error)
4905 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4906 __pyx_v_self->perm_r = ((
int *)malloc(__pyx_t_5));
4915 __pyx_t_1 = __Pyx_PyInt_FromSize_t((
sizeof(__pyx_t_5numpy_int32_t)));
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 191, __pyx_L1_error)
4916 __Pyx_GOTREF(__pyx_t_1);
4917 __pyx_t_4 = PyNumber_Multiply(__pyx_v_dim, __pyx_t_1);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 191, __pyx_L1_error)
4918 __Pyx_GOTREF(__pyx_t_4);
4919 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4920 __pyx_t_5 = __Pyx_PyInt_As_size_t(__pyx_t_4);
if (unlikely((__pyx_t_5 == (
size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 191, __pyx_L1_error)
4921 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4922 __pyx_v_self->etree = ((
int *)malloc(__pyx_t_5));
4936 __Pyx_XDECREF(__pyx_t_1);
4937 __Pyx_XDECREF(__pyx_t_4);
4938 __Pyx_AddTraceback(
"superluWrappers.SparseFactor.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4941 __Pyx_RefNannyFinishContext();
4953 static PyObject *__pyx_f_15superluWrappers_12SparseFactor__set_mat_types(
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_self) {
4954 PyObject *__pyx_r = NULL;
4955 __Pyx_RefNannyDeclarations
4956 __Pyx_RefNannySetupContext(
"_set_mat_types", 0);
4965 __pyx_v_self->A.Stype = SLU_NC;
4974 __pyx_v_self->A.Dtype = SLU_D;
4983 __pyx_v_self->A.Mtype = SLU_GE;
4992 __pyx_v_self->A.Store = (&__pyx_v_self->storeA);
5001 __pyx_v_self->AC.Stype = SLU_NCP;
5010 __pyx_v_self->AC.Dtype = SLU_D;
5019 __pyx_v_self->AC.Mtype = SLU_GE;
5028 __pyx_v_self->AC.Store = NULL;
5037 __pyx_v_self->L.Stype = SLU_NC;
5046 __pyx_v_self->L.Dtype = SLU_D;
5055 __pyx_v_self->L.Mtype = SLU_TRLU;
5064 __pyx_v_self->L.Store = NULL;
5073 __pyx_v_self->U.Stype = SLU_NC;
5082 __pyx_v_self->U.Dtype = SLU_D;
5091 __pyx_v_self->U.Mtype = SLU_TRU;
5100 __pyx_v_self->U.Store = NULL;
5109 __pyx_v_self->X.Stype = SLU_DN;
5118 __pyx_v_self->X.Dtype = SLU_D;
5127 __pyx_v_self->X.Mtype = SLU_GE;
5136 __pyx_v_self->X.Store = (&__pyx_v_self->storeX);
5147 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5148 __Pyx_XGIVEREF(__pyx_r);
5149 __Pyx_RefNannyFinishContext();
5162 static PyObject *__pyx_pw_15superluWrappers_12SparseFactor_3dim_1__get__(PyObject *__pyx_v_self);
5163 static PyObject *__pyx_pw_15superluWrappers_12SparseFactor_3dim_1__get__(PyObject *__pyx_v_self) {
5164 PyObject *__pyx_r = 0;
5165 __Pyx_RefNannyDeclarations
5166 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
5167 __pyx_r = __pyx_pf_15superluWrappers_12SparseFactor_3dim___get__(((
struct __pyx_obj_15superluWrappers_SparseFactor *)__pyx_v_self));
5170 __Pyx_RefNannyFinishContext();
5174 static PyObject *__pyx_pf_15superluWrappers_12SparseFactor_3dim___get__(
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_self) {
5175 PyObject *__pyx_r = NULL;
5176 __Pyx_RefNannyDeclarations
5177 PyObject *__pyx_t_1 = NULL;
5178 int __pyx_lineno = 0;
5179 const char *__pyx_filename = NULL;
5180 int __pyx_clineno = 0;
5181 __Pyx_RefNannySetupContext(
"__get__", 0);
5182 __Pyx_XDECREF(__pyx_r);
5183 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->dim);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 168, __pyx_L1_error)
5184 __Pyx_GOTREF(__pyx_t_1);
5185 __pyx_r = __pyx_t_1;
5191 __Pyx_XDECREF(__pyx_t_1);
5192 __Pyx_AddTraceback(
"superluWrappers.SparseFactor.dim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5195 __Pyx_XGIVEREF(__pyx_r);
5196 __Pyx_RefNannyFinishContext();
5201 static int __pyx_pw_15superluWrappers_12SparseFactor_3dim_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value);
5202 static int __pyx_pw_15superluWrappers_12SparseFactor_3dim_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
5204 __Pyx_RefNannyDeclarations
5205 __Pyx_RefNannySetupContext(
"__set__ (wrapper)", 0);
5206 __pyx_r = __pyx_pf_15superluWrappers_12SparseFactor_3dim_2__set__(((
struct __pyx_obj_15superluWrappers_SparseFactor *)__pyx_v_self), ((PyObject *)__pyx_v_value));
5209 __Pyx_RefNannyFinishContext();
5213 static int __pyx_pf_15superluWrappers_12SparseFactor_3dim_2__set__(
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_self, PyObject *__pyx_v_value) {
5215 __Pyx_RefNannyDeclarations
5217 int __pyx_lineno = 0;
5218 const char *__pyx_filename = NULL;
5219 int __pyx_clineno = 0;
5220 __Pyx_RefNannySetupContext(
"__set__", 0);
5221 __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_value);
if (unlikely((__pyx_t_1 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L1_error)
5222 __pyx_v_self->dim = __pyx_t_1;
5228 __Pyx_AddTraceback(
"superluWrappers.SparseFactor.dim.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5231 __Pyx_RefNannyFinishContext();
5242 static PyObject *__pyx_pw_15superluWrappers_12SparseFactor_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
5243 static PyObject *__pyx_pw_15superluWrappers_12SparseFactor_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
5244 PyObject *__pyx_r = 0;
5245 __Pyx_RefNannyDeclarations
5246 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
5247 __pyx_r = __pyx_pf_15superluWrappers_12SparseFactor_2__reduce_cython__(((
struct __pyx_obj_15superluWrappers_SparseFactor *)__pyx_v_self));
5250 __Pyx_RefNannyFinishContext();
5254 static PyObject *__pyx_pf_15superluWrappers_12SparseFactor_2__reduce_cython__(CYTHON_UNUSED
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_self) {
5255 PyObject *__pyx_r = NULL;
5256 __Pyx_RefNannyDeclarations
5257 PyObject *__pyx_t_1 = NULL;
5258 int __pyx_lineno = 0;
5259 const char *__pyx_filename = NULL;
5260 int __pyx_clineno = 0;
5261 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
5269 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__4, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
5270 __Pyx_GOTREF(__pyx_t_1);
5271 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
5272 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5273 __PYX_ERR(1, 2, __pyx_L1_error)
5283 __Pyx_XDECREF(__pyx_t_1);
5284 __Pyx_AddTraceback(
"superluWrappers.SparseFactor.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5286 __Pyx_XGIVEREF(__pyx_r);
5287 __Pyx_RefNannyFinishContext();
5299 static PyObject *__pyx_pw_15superluWrappers_12SparseFactor_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
5300 static PyObject *__pyx_pw_15superluWrappers_12SparseFactor_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
5301 PyObject *__pyx_r = 0;
5302 __Pyx_RefNannyDeclarations
5303 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
5304 __pyx_r = __pyx_pf_15superluWrappers_12SparseFactor_4__setstate_cython__(((
struct __pyx_obj_15superluWrappers_SparseFactor *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
5307 __Pyx_RefNannyFinishContext();
5311 static PyObject *__pyx_pf_15superluWrappers_12SparseFactor_4__setstate_cython__(CYTHON_UNUSED
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
5312 PyObject *__pyx_r = NULL;
5313 __Pyx_RefNannyDeclarations
5314 PyObject *__pyx_t_1 = NULL;
5315 int __pyx_lineno = 0;
5316 const char *__pyx_filename = NULL;
5317 int __pyx_clineno = 0;
5318 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
5325 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__5, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
5326 __Pyx_GOTREF(__pyx_t_1);
5327 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
5328 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5329 __PYX_ERR(1, 4, __pyx_L1_error)
5340 __Pyx_XDECREF(__pyx_t_1);
5341 __Pyx_AddTraceback(
"superluWrappers.SparseFactor.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5343 __Pyx_XGIVEREF(__pyx_r);
5344 __Pyx_RefNannyFinishContext();
5357 static PyObject *__pyx_pw_15superluWrappers_1sparseFactorPrepare(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
5358 static char __pyx_doc_15superluWrappers_sparseFactorPrepare[] =
" Python wrapper for superlu Sparse Factor Prepare function.\n\n Arguments\n ---------\n sparse_matrix : superluWrappers.SparseMatrix\n sparseFactor: superluWrappers.SparseFactor\n\n ";
5359 static PyMethodDef __pyx_mdef_15superluWrappers_1sparseFactorPrepare = {
"sparseFactorPrepare", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_15superluWrappers_1sparseFactorPrepare, METH_VARARGS|METH_KEYWORDS, __pyx_doc_15superluWrappers_sparseFactorPrepare};
5360 static PyObject *__pyx_pw_15superluWrappers_1sparseFactorPrepare(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5361 PyObject *__pyx_v_sparse_matrix = 0;
5362 PyObject *__pyx_v_sparseFactor = 0;
5363 int __pyx_lineno = 0;
5364 const char *__pyx_filename = NULL;
5365 int __pyx_clineno = 0;
5366 PyObject *__pyx_r = 0;
5367 __Pyx_RefNannyDeclarations
5368 __Pyx_RefNannySetupContext(
"sparseFactorPrepare (wrapper)", 0);
5370 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sparse_matrix,&__pyx_n_s_sparseFactor,0};
5371 PyObject* values[2] = {0,0};
5372 if (unlikely(__pyx_kwds)) {
5374 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5376 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5378 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5381 default:
goto __pyx_L5_argtuple_error;
5383 kw_args = PyDict_Size(__pyx_kwds);
5386 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sparse_matrix)) != 0)) kw_args--;
5387 else goto __pyx_L5_argtuple_error;
5390 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sparseFactor)) != 0)) kw_args--;
5392 __Pyx_RaiseArgtupleInvalid(
"sparseFactorPrepare", 1, 2, 2, 1); __PYX_ERR(0, 219, __pyx_L3_error)
5395 if (unlikely(kw_args > 0)) {
5396 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"sparseFactorPrepare") < 0)) __PYX_ERR(0, 219, __pyx_L3_error)
5398 }
else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
5399 goto __pyx_L5_argtuple_error;
5401 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5402 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5404 __pyx_v_sparse_matrix = values[0];
5405 __pyx_v_sparseFactor = values[1];
5407 goto __pyx_L4_argument_unpacking_done;
5408 __pyx_L5_argtuple_error:;
5409 __Pyx_RaiseArgtupleInvalid(
"sparseFactorPrepare", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 219, __pyx_L3_error)
5411 __Pyx_AddTraceback(
"superluWrappers.sparseFactorPrepare", __pyx_clineno, __pyx_lineno, __pyx_filename);
5412 __Pyx_RefNannyFinishContext();
5414 __pyx_L4_argument_unpacking_done:;
5415 __pyx_r = __pyx_pf_15superluWrappers_sparseFactorPrepare(__pyx_self, __pyx_v_sparse_matrix, __pyx_v_sparseFactor);
5418 __Pyx_RefNannyFinishContext();
5422 static PyObject *__pyx_pf_15superluWrappers_sparseFactorPrepare(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sparse_matrix, PyObject *__pyx_v_sparseFactor) {
5423 PyObject *__pyx_r = NULL;
5424 __Pyx_RefNannyDeclarations
5425 PyObject *__pyx_t_1 = NULL;
5426 int __pyx_lineno = 0;
5427 const char *__pyx_filename = NULL;
5428 int __pyx_clineno = 0;
5429 __Pyx_RefNannySetupContext(
"sparseFactorPrepare", 0);
5438 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sparse_matrix, __pyx_n_s_cSparseMatrix);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 229, __pyx_L1_error)
5439 __Pyx_GOTREF(__pyx_t_1);
5440 if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_15superluWrappers_cSparseMatrix))))) __PYX_ERR(0, 229, __pyx_L1_error)
5449 if (!(likely(((__pyx_v_sparseFactor) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_sparseFactor, __pyx_ptype_15superluWrappers_SparseFactor))))) __PYX_ERR(0, 230, __pyx_L1_error)
5458 __pyx_f_15superluWrappers_superluWrappersSparseFactorPrepare(((
struct __pyx_obj_15superluWrappers_cSparseMatrix *)__pyx_t_1), ((
struct __pyx_obj_15superluWrappers_SparseFactor *)__pyx_v_sparseFactor));
5459 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5470 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5473 __Pyx_XDECREF(__pyx_t_1);
5474 __Pyx_AddTraceback(
"superluWrappers.sparseFactorPrepare", __pyx_clineno, __pyx_lineno, __pyx_filename);
5477 __Pyx_XGIVEREF(__pyx_r);
5478 __Pyx_RefNannyFinishContext();
5490 static void __pyx_f_15superluWrappers_superluWrappersSparseFactorPrepare(
struct __pyx_obj_15superluWrappers_cSparseMatrix *__pyx_v_sm,
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_sparseFactor) {
5491 int __pyx_v_permc_spec;
5494 int __pyx_v_panel_size;
5498 PyObject *__pyx_v_i = NULL;
5499 __Pyx_RefNannyDeclarations
5500 __pyx_t_5numpy_int32_t __pyx_t_1;
5503 PyObject *__pyx_t_4 = NULL;
5504 PyObject *__pyx_t_5 = NULL;
5505 Py_ssize_t __pyx_t_6;
5506 PyObject *(*__pyx_t_7)(PyObject *);
5507 Py_ssize_t __pyx_t_8;
5508 Py_ssize_t __pyx_t_9;
5509 int __pyx_lineno = 0;
5510 const char *__pyx_filename = NULL;
5511 int __pyx_clineno = 0;
5512 __Pyx_RefNannySetupContext(
"superluWrappersSparseFactorPrepare", 0);
5521 __pyx_v_permc_spec = 3;
5539 __pyx_v_panel_size = 10;
5566 __pyx_v_work = NULL;
5575 __pyx_t_1 = __pyx_v_sm->A.nnz;
5576 __pyx_v_sparseFactor->storeA.nnz = __pyx_t_1;
5585 __pyx_v_sparseFactor->storeA.nzval = (&(__pyx_v_sm->A.nzval[0]));
5594 __pyx_v_sparseFactor->storeA.colptr = (&(__pyx_v_sm->A.rowptr[0]));
5603 __pyx_v_sparseFactor->storeA.rowind = (&(__pyx_v_sm->A.colind[0]));
5612 __pyx_t_2 = ((__pyx_v_sparseFactor->use_same_perm_c == 0) != 0);
5622 get_perm_c(__pyx_v_permc_spec, (&__pyx_v_sparseFactor->A), __pyx_v_sparseFactor->perm_c);
5631 __pyx_v_sparseFactor->use_same_perm_c = 1;
5649 __pyx_t_2 = ((__pyx_v_sparseFactor->use_same_sparsity == 0) != 0);
5659 __pyx_t_2 = ((__pyx_v_sparseFactor->AC.Store != NULL) != 0);
5669 Destroy_CompCol_Permuted((&__pyx_v_sparseFactor->AC));
5678 Destroy_SuperNode_Matrix((&__pyx_v_sparseFactor->L));
5687 Destroy_CompCol_Matrix((&__pyx_v_sparseFactor->U));
5705 sp_preorder((&__pyx_v_sparseFactor->options), (&__pyx_v_sparseFactor->A), __pyx_v_sparseFactor->perm_c, __pyx_v_sparseFactor->etree, (&__pyx_v_sparseFactor->AC));
5714 __pyx_v_sparseFactor->use_same_sparsity = 1;
5734 __pyx_v_sparseFactor->options.Fact = SamePattern_SameRowPerm;
5743 __pyx_t_3 = __pyx_v_sparseFactor->A.ncol;
5744 __pyx_v_n = __pyx_t_3;
5753 __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_n);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 268, __pyx_L1_error)
5754 __Pyx_GOTREF(__pyx_t_4);
5755 __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_4);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 268, __pyx_L1_error)
5756 __Pyx_GOTREF(__pyx_t_5);
5757 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5758 if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) {
5759 __pyx_t_4 = __pyx_t_5; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = 0;
5762 __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_5);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 268, __pyx_L1_error)
5763 __Pyx_GOTREF(__pyx_t_4);
5764 __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext;
if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 268, __pyx_L1_error)
5766 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5768 if (likely(!__pyx_t_7)) {
5769 if (likely(PyList_CheckExact(__pyx_t_4))) {
5770 if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4))
break;
5771 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5772 __pyx_t_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++;
if (unlikely(0 < 0)) __PYX_ERR(0, 268, __pyx_L1_error)
5774 __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++;
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 268, __pyx_L1_error)
5775 __Pyx_GOTREF(__pyx_t_5);
5778 if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4))
break;
5779 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5780 __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++;
if (unlikely(0 < 0)) __PYX_ERR(0, 268, __pyx_L1_error)
5782 __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++;
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 268, __pyx_L1_error)
5783 __Pyx_GOTREF(__pyx_t_5);
5787 __pyx_t_5 = __pyx_t_7(__pyx_t_4);
5788 if (unlikely(!__pyx_t_5)) {
5789 PyObject* exc_type = PyErr_Occurred();
5791 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
5792 else __PYX_ERR(0, 268, __pyx_L1_error)
5796 __Pyx_GOTREF(__pyx_t_5);
5798 __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_5);
5808 __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i);
if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 269, __pyx_L1_error)
5809 __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i);
if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 269, __pyx_L1_error)
5810 (((
struct __pyx_t_15superluWrappers__NCPformat *)__pyx_v_sparseFactor->AC.Store)->colbeg[(__pyx_v_sparseFactor->perm_c[__pyx_t_9])]) = (((
struct __pyx_t_15superluWrappers__NCformat *)__pyx_v_sparseFactor->A.Store)->colptr[__pyx_t_8]);
5819 __pyx_t_5 = __Pyx_PyInt_AddObjC(__pyx_v_i, __pyx_int_1, 1, 0, 0);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 270, __pyx_L1_error)
5820 __Pyx_GOTREF(__pyx_t_5);
5821 __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5);
if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 270, __pyx_L1_error)
5822 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5823 __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i);
if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 270, __pyx_L1_error)
5824 (((
struct __pyx_t_15superluWrappers__NCPformat *)__pyx_v_sparseFactor->AC.Store)->colend[(__pyx_v_sparseFactor->perm_c[__pyx_t_9])]) = (((
struct __pyx_t_15superluWrappers__NCformat *)__pyx_v_sparseFactor->A.Store)->colptr[__pyx_t_8]);
5834 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5845 dgstrf((&__pyx_v_sparseFactor->options), (&__pyx_v_sparseFactor->AC), __pyx_v_relax, __pyx_v_panel_size, __pyx_v_sparseFactor->etree, __pyx_v_work, __pyx_v_lwork, __pyx_v_sparseFactor->perm_c, __pyx_v_sparseFactor->perm_r, (&__pyx_v_sparseFactor->L), (&__pyx_v_sparseFactor->U), (&__pyx_v_sparseFactor->Glu), (&__pyx_v_sparseFactor->stat), (&__pyx_v_info));
5858 __Pyx_XDECREF(__pyx_t_4);
5859 __Pyx_XDECREF(__pyx_t_5);
5860 __Pyx_WriteUnraisable(
"superluWrappers.superluWrappersSparseFactorPrepare", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
5862 __Pyx_XDECREF(__pyx_v_i);
5863 __Pyx_RefNannyFinishContext();
5875 static PyObject *__pyx_pw_15superluWrappers_3sparseFactorSolve(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
5876 static char __pyx_doc_15superluWrappers_2sparseFactorSolve[] =
" Sparse factor solve wrappers\n\n Arguments\n ---------\n sparseFactor : superluWrappers.SparseFactor\n x (input / output) : np.array\n x serves as the right hand side and then becomes the solution\n ";
5877 static PyMethodDef __pyx_mdef_15superluWrappers_3sparseFactorSolve = {
"sparseFactorSolve", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_15superluWrappers_3sparseFactorSolve, METH_VARARGS|METH_KEYWORDS, __pyx_doc_15superluWrappers_2sparseFactorSolve};
5878 static PyObject *__pyx_pw_15superluWrappers_3sparseFactorSolve(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5879 PyObject *__pyx_v_sparseFactor = 0;
5880 PyObject *__pyx_v_x = 0;
5881 int __pyx_lineno = 0;
5882 const char *__pyx_filename = NULL;
5883 int __pyx_clineno = 0;
5884 PyObject *__pyx_r = 0;
5885 __Pyx_RefNannyDeclarations
5886 __Pyx_RefNannySetupContext(
"sparseFactorSolve (wrapper)", 0);
5888 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sparseFactor,&__pyx_n_s_x,0};
5889 PyObject* values[2] = {0,0};
5890 if (unlikely(__pyx_kwds)) {
5892 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5894 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5896 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5899 default:
goto __pyx_L5_argtuple_error;
5901 kw_args = PyDict_Size(__pyx_kwds);
5904 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sparseFactor)) != 0)) kw_args--;
5905 else goto __pyx_L5_argtuple_error;
5908 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
5910 __Pyx_RaiseArgtupleInvalid(
"sparseFactorSolve", 1, 2, 2, 1); __PYX_ERR(0, 286, __pyx_L3_error)
5913 if (unlikely(kw_args > 0)) {
5914 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"sparseFactorSolve") < 0)) __PYX_ERR(0, 286, __pyx_L3_error)
5916 }
else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
5917 goto __pyx_L5_argtuple_error;
5919 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5920 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5922 __pyx_v_sparseFactor = values[0];
5923 __pyx_v_x = values[1];
5925 goto __pyx_L4_argument_unpacking_done;
5926 __pyx_L5_argtuple_error:;
5927 __Pyx_RaiseArgtupleInvalid(
"sparseFactorSolve", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 286, __pyx_L3_error)
5929 __Pyx_AddTraceback(
"superluWrappers.sparseFactorSolve", __pyx_clineno, __pyx_lineno, __pyx_filename);
5930 __Pyx_RefNannyFinishContext();
5932 __pyx_L4_argument_unpacking_done:;
5933 __pyx_r = __pyx_pf_15superluWrappers_2sparseFactorSolve(__pyx_self, __pyx_v_sparseFactor, __pyx_v_x);
5936 __Pyx_RefNannyFinishContext();
5940 static PyObject *__pyx_pf_15superluWrappers_2sparseFactorSolve(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sparseFactor, PyObject *__pyx_v_x) {
5941 PyObject *__pyx_r = NULL;
5942 __Pyx_RefNannyDeclarations
5943 __Pyx_memviewslice __pyx_t_1 = { 0, 0, { 0 }, { 0 }, { 0 } };
5944 int __pyx_lineno = 0;
5945 const char *__pyx_filename = NULL;
5946 int __pyx_clineno = 0;
5947 __Pyx_RefNannySetupContext(
"sparseFactorSolve", 0);
5956 if (!(likely(((__pyx_v_sparseFactor) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_sparseFactor, __pyx_ptype_15superluWrappers_SparseFactor))))) __PYX_ERR(0, 296, __pyx_L1_error)
5965 __pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(__pyx_v_x, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 297, __pyx_L1_error)
5974 __pyx_f_15superluWrappers_superluWrappersSparseFactorSolve(((
struct __pyx_obj_15superluWrappers_SparseFactor *)__pyx_v_sparseFactor), __pyx_t_1);
5975 __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
5976 __pyx_t_1.memview = NULL;
5977 __pyx_t_1.data = NULL;
5988 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5991 __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
5992 __Pyx_AddTraceback(
"superluWrappers.sparseFactorSolve", __pyx_clineno, __pyx_lineno, __pyx_filename);
5995 __Pyx_XGIVEREF(__pyx_r);
5996 __Pyx_RefNannyFinishContext();
6008 static void __pyx_f_15superluWrappers_superluWrappersSparseFactorSolve(
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_sparseFactor, __Pyx_memviewslice __pyx_v_x) {
6009 trans_t __pyx_v_trans;
6011 __Pyx_RefNannyDeclarations
6012 Py_ssize_t __pyx_t_1;
6013 __Pyx_RefNannySetupContext(
"superluWrappersSparseFactorSolve", 0);
6022 __pyx_v_trans = TRANS;
6041 __pyx_v_sparseFactor->storeX.nzval = (&(*((__pyx_t_5numpy_float64_t *) ( (__pyx_v_x.data + __pyx_t_1 * __pyx_v_x.strides[0]) ))));
6050 dgstrs(__pyx_v_trans, (&__pyx_v_sparseFactor->L), (&__pyx_v_sparseFactor->U), __pyx_v_sparseFactor->perm_c, __pyx_v_sparseFactor->perm_r, (&__pyx_v_sparseFactor->X), (&__pyx_v_sparseFactor->stat), (&__pyx_v_info));
6061 __Pyx_RefNannyFinishContext();
6072 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
6073 PyObject *__pyx_r = NULL;
6074 __Pyx_RefNannyDeclarations
6075 PyObject *__pyx_t_1 = NULL;
6076 int __pyx_lineno = 0;
6077 const char *__pyx_filename = NULL;
6078 int __pyx_clineno = 0;
6079 __Pyx_RefNannySetupContext(
"PyArray_MultiIterNew1", 0);
6088 __Pyx_XDECREF(__pyx_r);
6089 __pyx_t_1 = PyArray_MultiIterNew(1, ((
void *)__pyx_v_a));
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 743, __pyx_L1_error)
6090 __Pyx_GOTREF(__pyx_t_1);
6091 __pyx_r = __pyx_t_1;
6105 __Pyx_XDECREF(__pyx_t_1);
6106 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
6109 __Pyx_XGIVEREF(__pyx_r);
6110 __Pyx_RefNannyFinishContext();
6122 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
6123 PyObject *__pyx_r = NULL;
6124 __Pyx_RefNannyDeclarations
6125 PyObject *__pyx_t_1 = NULL;
6126 int __pyx_lineno = 0;
6127 const char *__pyx_filename = NULL;
6128 int __pyx_clineno = 0;
6129 __Pyx_RefNannySetupContext(
"PyArray_MultiIterNew2", 0);
6138 __Pyx_XDECREF(__pyx_r);
6139 __pyx_t_1 = PyArray_MultiIterNew(2, ((
void *)__pyx_v_a), ((
void *)__pyx_v_b));
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 746, __pyx_L1_error)
6140 __Pyx_GOTREF(__pyx_t_1);
6141 __pyx_r = __pyx_t_1;
6155 __Pyx_XDECREF(__pyx_t_1);
6156 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
6159 __Pyx_XGIVEREF(__pyx_r);
6160 __Pyx_RefNannyFinishContext();
6172 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
6173 PyObject *__pyx_r = NULL;
6174 __Pyx_RefNannyDeclarations
6175 PyObject *__pyx_t_1 = NULL;
6176 int __pyx_lineno = 0;
6177 const char *__pyx_filename = NULL;
6178 int __pyx_clineno = 0;
6179 __Pyx_RefNannySetupContext(
"PyArray_MultiIterNew3", 0);
6188 __Pyx_XDECREF(__pyx_r);
6189 __pyx_t_1 = PyArray_MultiIterNew(3, ((
void *)__pyx_v_a), ((
void *)__pyx_v_b), ((
void *)__pyx_v_c));
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 749, __pyx_L1_error)
6190 __Pyx_GOTREF(__pyx_t_1);
6191 __pyx_r = __pyx_t_1;
6205 __Pyx_XDECREF(__pyx_t_1);
6206 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
6209 __Pyx_XGIVEREF(__pyx_r);
6210 __Pyx_RefNannyFinishContext();
6222 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) {
6223 PyObject *__pyx_r = NULL;
6224 __Pyx_RefNannyDeclarations
6225 PyObject *__pyx_t_1 = NULL;
6226 int __pyx_lineno = 0;
6227 const char *__pyx_filename = NULL;
6228 int __pyx_clineno = 0;
6229 __Pyx_RefNannySetupContext(
"PyArray_MultiIterNew4", 0);
6238 __Pyx_XDECREF(__pyx_r);
6239 __pyx_t_1 = PyArray_MultiIterNew(4, ((
void *)__pyx_v_a), ((
void *)__pyx_v_b), ((
void *)__pyx_v_c), ((
void *)__pyx_v_d));
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 752, __pyx_L1_error)
6240 __Pyx_GOTREF(__pyx_t_1);
6241 __pyx_r = __pyx_t_1;
6255 __Pyx_XDECREF(__pyx_t_1);
6256 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
6259 __Pyx_XGIVEREF(__pyx_r);
6260 __Pyx_RefNannyFinishContext();
6272 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) {
6273 PyObject *__pyx_r = NULL;
6274 __Pyx_RefNannyDeclarations
6275 PyObject *__pyx_t_1 = NULL;
6276 int __pyx_lineno = 0;
6277 const char *__pyx_filename = NULL;
6278 int __pyx_clineno = 0;
6279 __Pyx_RefNannySetupContext(
"PyArray_MultiIterNew5", 0);
6288 __Pyx_XDECREF(__pyx_r);
6289 __pyx_t_1 = PyArray_MultiIterNew(5, ((
void *)__pyx_v_a), ((
void *)__pyx_v_b), ((
void *)__pyx_v_c), ((
void *)__pyx_v_d), ((
void *)__pyx_v_e));
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 755, __pyx_L1_error)
6290 __Pyx_GOTREF(__pyx_t_1);
6291 __pyx_r = __pyx_t_1;
6305 __Pyx_XDECREF(__pyx_t_1);
6306 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
6309 __Pyx_XGIVEREF(__pyx_r);
6310 __Pyx_RefNannyFinishContext();
6322 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
6323 PyObject *__pyx_r = NULL;
6324 __Pyx_RefNannyDeclarations
6326 __Pyx_RefNannySetupContext(
"PyDataType_SHAPE", 0);
6335 __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
6345 __Pyx_XDECREF(__pyx_r);
6346 __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
6347 __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
6367 __Pyx_XDECREF(__pyx_r);
6368 __Pyx_INCREF(__pyx_empty_tuple);
6369 __pyx_r = __pyx_empty_tuple;
6383 __Pyx_XGIVEREF(__pyx_r);
6384 __Pyx_RefNannyFinishContext();
6396 static CYTHON_INLINE
char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr,
char *__pyx_v_f,
char *__pyx_v_end,
int *__pyx_v_offset) {
6397 PyArray_Descr *__pyx_v_child = 0;
6398 int __pyx_v_endian_detector;
6399 int __pyx_v_little_endian;
6400 PyObject *__pyx_v_fields = 0;
6401 PyObject *__pyx_v_childname = NULL;
6402 PyObject *__pyx_v_new_offset = NULL;
6403 PyObject *__pyx_v_t = NULL;
6405 __Pyx_RefNannyDeclarations
6406 PyObject *__pyx_t_1 = NULL;
6407 Py_ssize_t __pyx_t_2;
6408 PyObject *__pyx_t_3 = NULL;
6409 PyObject *__pyx_t_4 = NULL;
6415 int __pyx_lineno = 0;
6416 const char *__pyx_filename = NULL;
6417 int __pyx_clineno = 0;
6418 __Pyx_RefNannySetupContext(
"_util_dtypestring", 0);
6427 __pyx_v_endian_detector = 1;
6436 __pyx_v_little_endian = ((((
char *)(&__pyx_v_endian_detector))[0]) != 0);
6445 if (unlikely(__pyx_v_descr->names == Py_None)) {
6446 PyErr_SetString(PyExc_TypeError,
"'NoneType' object is not iterable");
6447 __PYX_ERR(2, 772, __pyx_L1_error)
6449 __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
6451 if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1))
break;
6452 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6453 __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++;
if (unlikely(0 < 0)) __PYX_ERR(2, 772, __pyx_L1_error)
6455 __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++;
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 772, __pyx_L1_error)
6456 __Pyx_GOTREF(__pyx_t_3);
6458 __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
6468 if (unlikely(__pyx_v_descr->fields == Py_None)) {
6469 PyErr_SetString(PyExc_TypeError,
"'NoneType' object is not subscriptable");
6470 __PYX_ERR(2, 773, __pyx_L1_error)
6472 __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 773, __pyx_L1_error)
6473 __Pyx_GOTREF(__pyx_t_3);
6474 if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError,
"Expected %.16s, got %.200s",
"tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(2, 773, __pyx_L1_error)
6475 __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
6485 if (likely(__pyx_v_fields != Py_None)) {
6486 PyObject* sequence = __pyx_v_fields;
6487 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
6488 if (unlikely(size != 2)) {
6489 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
6490 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
6491 __PYX_ERR(2, 774, __pyx_L1_error)
6493 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6494 __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
6495 __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
6496 __Pyx_INCREF(__pyx_t_3);
6497 __Pyx_INCREF(__pyx_t_4);
6499 __pyx_t_3 = PySequence_ITEM(sequence, 0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 774, __pyx_L1_error)
6500 __Pyx_GOTREF(__pyx_t_3);
6501 __pyx_t_4 = PySequence_ITEM(sequence, 1);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 774, __pyx_L1_error)
6502 __Pyx_GOTREF(__pyx_t_4);
6505 __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 774, __pyx_L1_error)
6507 if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(2, 774, __pyx_L1_error)
6508 __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
6510 __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
6520 __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0]));
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 776, __pyx_L1_error)
6521 __Pyx_GOTREF(__pyx_t_4);
6522 __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 776, __pyx_L1_error)
6523 __Pyx_GOTREF(__pyx_t_3);
6524 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6525 __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3);
if (unlikely((__pyx_t_5 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(2, 776, __pyx_L1_error)
6526 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6527 __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((
int)__pyx_t_5)) < 15) != 0);
6528 if (unlikely(__pyx_t_6)) {
6537 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__6, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 777, __pyx_L1_error)
6538 __Pyx_GOTREF(__pyx_t_3);
6539 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
6540 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6541 __PYX_ERR(2, 777, __pyx_L1_error)
6559 __pyx_t_7 = ((__pyx_v_child->byteorder ==
'>') != 0);
6561 goto __pyx_L8_next_or;
6564 __pyx_t_7 = (__pyx_v_little_endian != 0);
6567 __pyx_t_6 = __pyx_t_7;
6568 goto __pyx_L7_bool_binop_done;
6579 __pyx_t_7 = ((__pyx_v_child->byteorder ==
'<') != 0);
6582 __pyx_t_6 = __pyx_t_7;
6583 goto __pyx_L7_bool_binop_done;
6585 __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0);
6586 __pyx_t_6 = __pyx_t_7;
6587 __pyx_L7_bool_binop_done:;
6596 if (unlikely(__pyx_t_6)) {
6605 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 781, __pyx_L1_error)
6606 __Pyx_GOTREF(__pyx_t_3);
6607 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
6608 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6609 __PYX_ERR(2, 781, __pyx_L1_error)
6628 __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0]));
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 791, __pyx_L1_error)
6629 __Pyx_GOTREF(__pyx_t_3);
6630 __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 791, __pyx_L1_error)
6631 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6632 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4);
if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 791, __pyx_L1_error)
6633 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6634 if (!__pyx_t_6)
break;
6643 (__pyx_v_f[0]) = 0x78;
6652 __pyx_v_f = (__pyx_v_f + 1);
6662 (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1);
6673 (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize);
6682 __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
6692 __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 799, __pyx_L1_error)
6693 __Pyx_GOTREF(__pyx_t_4);
6694 __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
6704 __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
6705 if (unlikely(__pyx_t_6)) {
6714 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__8, NULL);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 801, __pyx_L1_error)
6715 __Pyx_GOTREF(__pyx_t_4);
6716 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
6717 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6718 __PYX_ERR(2, 801, __pyx_L1_error)
6736 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 804, __pyx_L1_error)
6737 __Pyx_GOTREF(__pyx_t_4);
6738 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 804, __pyx_L1_error)
6739 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6740 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3);
if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 804, __pyx_L1_error)
6741 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6743 (__pyx_v_f[0]) = 98;
6754 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 805, __pyx_L1_error)
6755 __Pyx_GOTREF(__pyx_t_3);
6756 __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 805, __pyx_L1_error)
6757 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6758 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4);
if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 805, __pyx_L1_error)
6759 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6761 (__pyx_v_f[0]) = 66;
6772 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 806, __pyx_L1_error)
6773 __Pyx_GOTREF(__pyx_t_4);
6774 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 806, __pyx_L1_error)
6775 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6776 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3);
if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 806, __pyx_L1_error)
6777 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6779 (__pyx_v_f[0]) = 0x68;
6790 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 807, __pyx_L1_error)
6791 __Pyx_GOTREF(__pyx_t_3);
6792 __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 807, __pyx_L1_error)
6793 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6794 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4);
if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 807, __pyx_L1_error)
6795 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6797 (__pyx_v_f[0]) = 72;
6808 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 808, __pyx_L1_error)
6809 __Pyx_GOTREF(__pyx_t_4);
6810 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 808, __pyx_L1_error)
6811 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6812 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3);
if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 808, __pyx_L1_error)
6813 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6815 (__pyx_v_f[0]) = 0x69;
6826 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 809, __pyx_L1_error)
6827 __Pyx_GOTREF(__pyx_t_3);
6828 __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 809, __pyx_L1_error)
6829 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6830 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4);
if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 809, __pyx_L1_error)
6831 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6833 (__pyx_v_f[0]) = 73;
6844 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 810, __pyx_L1_error)
6845 __Pyx_GOTREF(__pyx_t_4);
6846 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 810, __pyx_L1_error)
6847 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6848 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3);
if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 810, __pyx_L1_error)
6849 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6851 (__pyx_v_f[0]) = 0x6C;
6862 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 811, __pyx_L1_error)
6863 __Pyx_GOTREF(__pyx_t_3);
6864 __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 811, __pyx_L1_error)
6865 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6866 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4);
if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 811, __pyx_L1_error)
6867 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6869 (__pyx_v_f[0]) = 76;
6880 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 812, __pyx_L1_error)
6881 __Pyx_GOTREF(__pyx_t_4);
6882 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 812, __pyx_L1_error)
6883 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6884 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3);
if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 812, __pyx_L1_error)
6885 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6887 (__pyx_v_f[0]) = 0x71;
6898 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 813, __pyx_L1_error)
6899 __Pyx_GOTREF(__pyx_t_3);
6900 __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 813, __pyx_L1_error)
6901 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6902 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4);
if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 813, __pyx_L1_error)
6903 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6905 (__pyx_v_f[0]) = 81;
6916 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 814, __pyx_L1_error)
6917 __Pyx_GOTREF(__pyx_t_4);
6918 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 814, __pyx_L1_error)
6919 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6920 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3);
if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 814, __pyx_L1_error)
6921 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6923 (__pyx_v_f[0]) = 0x66;
6934 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 815, __pyx_L1_error)
6935 __Pyx_GOTREF(__pyx_t_3);
6936 __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 815, __pyx_L1_error)
6937 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6938 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4);
if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 815, __pyx_L1_error)
6939 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6941 (__pyx_v_f[0]) = 0x64;
6952 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 816, __pyx_L1_error)
6953 __Pyx_GOTREF(__pyx_t_4);
6954 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 816, __pyx_L1_error)
6955 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6956 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3);
if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 816, __pyx_L1_error)
6957 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6959 (__pyx_v_f[0]) = 0x67;
6970 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 817, __pyx_L1_error)
6971 __Pyx_GOTREF(__pyx_t_3);
6972 __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 817, __pyx_L1_error)
6973 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6974 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4);
if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 817, __pyx_L1_error)
6975 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6977 (__pyx_v_f[0]) = 90;
6978 (__pyx_v_f[1]) = 0x66;
6979 __pyx_v_f = (__pyx_v_f + 1);
6990 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 818, __pyx_L1_error)
6991 __Pyx_GOTREF(__pyx_t_4);
6992 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 818, __pyx_L1_error)
6993 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6994 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3);
if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 818, __pyx_L1_error)
6995 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6997 (__pyx_v_f[0]) = 90;
6998 (__pyx_v_f[1]) = 0x64;
6999 __pyx_v_f = (__pyx_v_f + 1);
7010 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 819, __pyx_L1_error)
7011 __Pyx_GOTREF(__pyx_t_3);
7012 __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 819, __pyx_L1_error)
7013 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7014 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4);
if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 819, __pyx_L1_error)
7015 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7017 (__pyx_v_f[0]) = 90;
7018 (__pyx_v_f[1]) = 0x67;
7019 __pyx_v_f = (__pyx_v_f + 1);
7030 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 820, __pyx_L1_error)
7031 __Pyx_GOTREF(__pyx_t_4);
7032 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 820, __pyx_L1_error)
7033 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7034 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3);
if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 820, __pyx_L1_error)
7035 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7036 if (likely(__pyx_t_6)) {
7037 (__pyx_v_f[0]) = 79;
7049 __pyx_t_3 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 822, __pyx_L1_error)
7050 __Pyx_GOTREF(__pyx_t_3);
7051 __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 822, __pyx_L1_error)
7052 __Pyx_GOTREF(__pyx_t_4);
7053 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7054 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
7055 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7056 __PYX_ERR(2, 822, __pyx_L1_error)
7067 __pyx_v_f = (__pyx_v_f + 1);
7087 __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset);
if (unlikely(__pyx_t_9 == ((
char *)NULL))) __PYX_ERR(2, 827, __pyx_L1_error)
7088 __pyx_v_f = __pyx_t_9;
7100 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7109 __pyx_r = __pyx_v_f;
7122 __Pyx_XDECREF(__pyx_t_1);
7123 __Pyx_XDECREF(__pyx_t_3);
7124 __Pyx_XDECREF(__pyx_t_4);
7125 __Pyx_AddTraceback(
"numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
7128 __Pyx_XDECREF((PyObject *)__pyx_v_child);
7129 __Pyx_XDECREF(__pyx_v_fields);
7130 __Pyx_XDECREF(__pyx_v_childname);
7131 __Pyx_XDECREF(__pyx_v_new_offset);
7132 __Pyx_XDECREF(__pyx_v_t);
7133 __Pyx_RefNannyFinishContext();
7145 static CYTHON_INLINE
void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
7146 __Pyx_RefNannyDeclarations
7147 __Pyx_RefNannySetupContext(
"set_array_base", 0);
7156 Py_INCREF(__pyx_v_base);
7165 (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
7176 __Pyx_RefNannyFinishContext();
7187 static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
7188 PyObject *__pyx_v_base;
7189 PyObject *__pyx_r = NULL;
7190 __Pyx_RefNannyDeclarations
7192 __Pyx_RefNannySetupContext(
"get_array_base", 0);
7201 __pyx_v_base = PyArray_BASE(__pyx_v_arr);
7210 __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
7220 __Pyx_XDECREF(__pyx_r);
7221 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7240 __Pyx_XDECREF(__pyx_r);
7241 __Pyx_INCREF(((PyObject *)__pyx_v_base));
7242 __pyx_r = ((PyObject *)__pyx_v_base);
7255 __Pyx_XGIVEREF(__pyx_r);
7256 __Pyx_RefNannyFinishContext();
7268 static CYTHON_INLINE
int __pyx_f_5numpy_import_array(
void) {
7270 __Pyx_RefNannyDeclarations
7271 PyObject *__pyx_t_1 = NULL;
7272 PyObject *__pyx_t_2 = NULL;
7273 PyObject *__pyx_t_3 = NULL;
7275 PyObject *__pyx_t_5 = NULL;
7276 PyObject *__pyx_t_6 = NULL;
7277 PyObject *__pyx_t_7 = NULL;
7278 PyObject *__pyx_t_8 = NULL;
7279 int __pyx_lineno = 0;
7280 const char *__pyx_filename = NULL;
7281 int __pyx_clineno = 0;
7282 __Pyx_RefNannySetupContext(
"import_array", 0);
7292 __Pyx_PyThreadState_declare
7293 __Pyx_PyThreadState_assign
7294 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
7295 __Pyx_XGOTREF(__pyx_t_1);
7296 __Pyx_XGOTREF(__pyx_t_2);
7297 __Pyx_XGOTREF(__pyx_t_3);
7307 __pyx_t_4 = _import_array();
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(2, 957, __pyx_L3_error)
7317 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7318 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
7319 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7320 goto __pyx_L8_try_end;
7330 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
7332 __Pyx_AddTraceback(
"numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
7333 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 958, __pyx_L5_except_error)
7334 __Pyx_GOTREF(__pyx_t_5);
7335 __Pyx_GOTREF(__pyx_t_6);
7336 __Pyx_GOTREF(__pyx_t_7);
7345 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__9, NULL);
if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 959, __pyx_L5_except_error)
7346 __Pyx_GOTREF(__pyx_t_8);
7347 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
7348 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7349 __PYX_ERR(2, 959, __pyx_L5_except_error)
7351 goto __pyx_L5_except_error;
7352 __pyx_L5_except_error:;
7361 __Pyx_XGIVEREF(__pyx_t_1);
7362 __Pyx_XGIVEREF(__pyx_t_2);
7363 __Pyx_XGIVEREF(__pyx_t_3);
7364 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
7365 goto __pyx_L1_error;
7381 __Pyx_XDECREF(__pyx_t_5);
7382 __Pyx_XDECREF(__pyx_t_6);
7383 __Pyx_XDECREF(__pyx_t_7);
7384 __Pyx_XDECREF(__pyx_t_8);
7385 __Pyx_AddTraceback(
"numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
7388 __Pyx_RefNannyFinishContext();
7400 static CYTHON_INLINE
int __pyx_f_5numpy_import_umath(
void) {
7402 __Pyx_RefNannyDeclarations
7403 PyObject *__pyx_t_1 = NULL;
7404 PyObject *__pyx_t_2 = NULL;
7405 PyObject *__pyx_t_3 = NULL;
7407 PyObject *__pyx_t_5 = NULL;
7408 PyObject *__pyx_t_6 = NULL;
7409 PyObject *__pyx_t_7 = NULL;
7410 PyObject *__pyx_t_8 = NULL;
7411 int __pyx_lineno = 0;
7412 const char *__pyx_filename = NULL;
7413 int __pyx_clineno = 0;
7414 __Pyx_RefNannySetupContext(
"import_umath", 0);
7424 __Pyx_PyThreadState_declare
7425 __Pyx_PyThreadState_assign
7426 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
7427 __Pyx_XGOTREF(__pyx_t_1);
7428 __Pyx_XGOTREF(__pyx_t_2);
7429 __Pyx_XGOTREF(__pyx_t_3);
7439 __pyx_t_4 = _import_umath();
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(2, 963, __pyx_L3_error)
7449 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7450 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
7451 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7452 goto __pyx_L8_try_end;
7462 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
7464 __Pyx_AddTraceback(
"numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
7465 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 964, __pyx_L5_except_error)
7466 __Pyx_GOTREF(__pyx_t_5);
7467 __Pyx_GOTREF(__pyx_t_6);
7468 __Pyx_GOTREF(__pyx_t_7);
7477 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__10, NULL);
if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 965, __pyx_L5_except_error)
7478 __Pyx_GOTREF(__pyx_t_8);
7479 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
7480 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7481 __PYX_ERR(2, 965, __pyx_L5_except_error)
7483 goto __pyx_L5_except_error;
7484 __pyx_L5_except_error:;
7493 __Pyx_XGIVEREF(__pyx_t_1);
7494 __Pyx_XGIVEREF(__pyx_t_2);
7495 __Pyx_XGIVEREF(__pyx_t_3);
7496 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
7497 goto __pyx_L1_error;
7513 __Pyx_XDECREF(__pyx_t_5);
7514 __Pyx_XDECREF(__pyx_t_6);
7515 __Pyx_XDECREF(__pyx_t_7);
7516 __Pyx_XDECREF(__pyx_t_8);
7517 __Pyx_AddTraceback(
"numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
7520 __Pyx_RefNannyFinishContext();
7532 static CYTHON_INLINE
int __pyx_f_5numpy_import_ufunc(
void) {
7534 __Pyx_RefNannyDeclarations
7535 PyObject *__pyx_t_1 = NULL;
7536 PyObject *__pyx_t_2 = NULL;
7537 PyObject *__pyx_t_3 = NULL;
7539 PyObject *__pyx_t_5 = NULL;
7540 PyObject *__pyx_t_6 = NULL;
7541 PyObject *__pyx_t_7 = NULL;
7542 PyObject *__pyx_t_8 = NULL;
7543 int __pyx_lineno = 0;
7544 const char *__pyx_filename = NULL;
7545 int __pyx_clineno = 0;
7546 __Pyx_RefNannySetupContext(
"import_ufunc", 0);
7556 __Pyx_PyThreadState_declare
7557 __Pyx_PyThreadState_assign
7558 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
7559 __Pyx_XGOTREF(__pyx_t_1);
7560 __Pyx_XGOTREF(__pyx_t_2);
7561 __Pyx_XGOTREF(__pyx_t_3);
7571 __pyx_t_4 = _import_umath();
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(2, 969, __pyx_L3_error)
7581 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7582 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
7583 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7584 goto __pyx_L8_try_end;
7594 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
7596 __Pyx_AddTraceback(
"numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
7597 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 970, __pyx_L5_except_error)
7598 __Pyx_GOTREF(__pyx_t_5);
7599 __Pyx_GOTREF(__pyx_t_6);
7600 __Pyx_GOTREF(__pyx_t_7);
7609 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__10, NULL);
if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 971, __pyx_L5_except_error)
7610 __Pyx_GOTREF(__pyx_t_8);
7611 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
7612 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7613 __PYX_ERR(2, 971, __pyx_L5_except_error)
7615 goto __pyx_L5_except_error;
7616 __pyx_L5_except_error:;
7625 __Pyx_XGIVEREF(__pyx_t_1);
7626 __Pyx_XGIVEREF(__pyx_t_2);
7627 __Pyx_XGIVEREF(__pyx_t_3);
7628 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
7629 goto __pyx_L1_error;
7645 __Pyx_XDECREF(__pyx_t_5);
7646 __Pyx_XDECREF(__pyx_t_6);
7647 __Pyx_XDECREF(__pyx_t_7);
7648 __Pyx_XDECREF(__pyx_t_8);
7649 __Pyx_AddTraceback(
"numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
7652 __Pyx_RefNannyFinishContext();
7665 static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
7666 static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7667 PyObject *__pyx_v_shape = 0;
7668 Py_ssize_t __pyx_v_itemsize;
7669 PyObject *__pyx_v_format = 0;
7670 PyObject *__pyx_v_mode = 0;
7671 int __pyx_v_allocate_buffer;
7672 int __pyx_lineno = 0;
7673 const char *__pyx_filename = NULL;
7674 int __pyx_clineno = 0;
7676 __Pyx_RefNannyDeclarations
7677 __Pyx_RefNannySetupContext(
"__cinit__ (wrapper)", 0);
7679 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shape,&__pyx_n_s_itemsize,&__pyx_n_s_format,&__pyx_n_s_mode,&__pyx_n_s_allocate_buffer,0};
7680 PyObject* values[5] = {0,0,0,0,0};
7681 values[3] = ((PyObject *)__pyx_n_s_c);
7682 if (unlikely(__pyx_kwds)) {
7684 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7686 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7688 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7690 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7692 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7694 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7697 default:
goto __pyx_L5_argtuple_error;
7699 kw_args = PyDict_Size(__pyx_kwds);
7702 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--;
7703 else goto __pyx_L5_argtuple_error;
7706 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--;
7708 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 3, 5, 1); __PYX_ERR(1, 122, __pyx_L3_error)
7712 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--;
7714 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 3, 5, 2); __PYX_ERR(1, 122, __pyx_L3_error)
7719 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode);
7720 if (value) { values[3] = value; kw_args--; }
7725 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allocate_buffer);
7726 if (value) { values[4] = value; kw_args--; }
7729 if (unlikely(kw_args > 0)) {
7730 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__cinit__") < 0)) __PYX_ERR(1, 122, __pyx_L3_error)
7733 switch (PyTuple_GET_SIZE(__pyx_args)) {
7734 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7736 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7738 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7739 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7740 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7742 default:
goto __pyx_L5_argtuple_error;
7745 __pyx_v_shape = ((PyObject*)values[0]);
7746 __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]);
if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 122, __pyx_L3_error)
7747 __pyx_v_format = values[2];
7748 __pyx_v_mode = values[3];
7750 __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]);
if (unlikely((__pyx_v_allocate_buffer == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 123, __pyx_L3_error)
7760 __pyx_v_allocate_buffer = ((int)1);
7763 goto __pyx_L4_argument_unpacking_done;
7764 __pyx_L5_argtuple_error:;
7765 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 122, __pyx_L3_error)
7767 __Pyx_AddTraceback(
"View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7768 __Pyx_RefNannyFinishContext();
7770 __pyx_L4_argument_unpacking_done:;
7771 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1,
"shape", 1))) __PYX_ERR(1, 122, __pyx_L1_error)
7772 if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) {
7773 PyErr_Format(PyExc_TypeError,
"Argument '%.200s' must not be None",
"format"); __PYX_ERR(1, 122, __pyx_L1_error)
7775 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((
struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer);
7790 __Pyx_RefNannyFinishContext();
7794 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode,
int __pyx_v_allocate_buffer) {
7796 Py_ssize_t __pyx_v_i;
7797 Py_ssize_t __pyx_v_dim;
7798 PyObject **__pyx_v_p;
7801 __Pyx_RefNannyDeclarations
7802 Py_ssize_t __pyx_t_1;
7804 PyObject *__pyx_t_3 = NULL;
7806 PyObject *__pyx_t_5 = NULL;
7807 PyObject *__pyx_t_6 = NULL;
7810 Py_ssize_t __pyx_t_9;
7811 PyObject *__pyx_t_10 = NULL;
7812 Py_ssize_t __pyx_t_11;
7813 int __pyx_lineno = 0;
7814 const char *__pyx_filename = NULL;
7815 int __pyx_clineno = 0;
7816 __Pyx_RefNannySetupContext(
"__cinit__", 0);
7817 __Pyx_INCREF(__pyx_v_format);
7826 if (unlikely(__pyx_v_shape == Py_None)) {
7827 PyErr_SetString(PyExc_TypeError,
"object of type 'NoneType' has no len()");
7828 __PYX_ERR(1, 129, __pyx_L1_error)
7830 __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape);
if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 129, __pyx_L1_error)
7831 __pyx_v_self->ndim = ((int)__pyx_t_1);
7840 __pyx_v_self->itemsize = __pyx_v_itemsize;
7849 __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
7850 if (unlikely(__pyx_t_2)) {
7859 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 133, __pyx_L1_error)
7860 __Pyx_GOTREF(__pyx_t_3);
7861 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
7862 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7863 __PYX_ERR(1, 133, __pyx_L1_error)
7881 __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0);
7882 if (unlikely(__pyx_t_2)) {
7891 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 136, __pyx_L1_error)
7892 __Pyx_GOTREF(__pyx_t_3);
7893 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
7894 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7895 __PYX_ERR(1, 136, __pyx_L1_error)
7913 __pyx_t_2 = PyBytes_Check(__pyx_v_format);
7914 __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0);
7924 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 139, __pyx_L1_error)
7925 __Pyx_GOTREF(__pyx_t_5);
7927 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
7928 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
7929 if (likely(__pyx_t_6)) {
7930 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_5);
7931 __Pyx_INCREF(__pyx_t_6);
7932 __Pyx_INCREF(
function);
7933 __Pyx_DECREF_SET(__pyx_t_5,
function);
7936 __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_s_ASCII) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_ASCII);
7937 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7938 if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 139, __pyx_L1_error)
7939 __Pyx_GOTREF(__pyx_t_3);
7940 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7941 __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3);
7960 if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None)||(PyErr_Format(PyExc_TypeError,
"Expected %.16s, got %.200s",
"bytes", Py_TYPE(__pyx_v_format)->tp_name), 0))) __PYX_ERR(1, 140, __pyx_L1_error)
7961 __pyx_t_3 = __pyx_v_format;
7962 __Pyx_INCREF(__pyx_t_3);
7963 __Pyx_GIVEREF(__pyx_t_3);
7964 __Pyx_GOTREF(__pyx_v_self->_format);
7965 __Pyx_DECREF(__pyx_v_self->_format);
7966 __pyx_v_self->_format = ((PyObject*)__pyx_t_3);
7976 if (unlikely(__pyx_v_self->_format == Py_None)) {
7977 PyErr_SetString(PyExc_TypeError,
"expected bytes, NoneType found");
7978 __PYX_ERR(1, 141, __pyx_L1_error)
7980 __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format);
if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(1, 141, __pyx_L1_error)
7981 __pyx_v_self->format = __pyx_t_7;
7990 __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((
sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2)));
7999 __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim);
8008 __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0);
8009 if (unlikely(__pyx_t_4)) {
8018 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__13, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 148, __pyx_L1_error)
8019 __Pyx_GOTREF(__pyx_t_3);
8020 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
8021 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8022 __PYX_ERR(1, 148, __pyx_L1_error)
8041 __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
8043 if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3))
break;
8044 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8045 __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++;
if (unlikely(0 < 0)) __PYX_ERR(1, 151, __pyx_L1_error)
8047 __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++;
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 151, __pyx_L1_error)
8048 __Pyx_GOTREF(__pyx_t_5);
8050 __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5);
if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 151, __pyx_L1_error)
8051 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8052 __pyx_v_dim = __pyx_t_9;
8053 __pyx_v_idx = __pyx_t_8;
8054 __pyx_t_8 = (__pyx_t_8 + 1);
8063 __pyx_t_4 = ((__pyx_v_dim <= 0) != 0);
8064 if (unlikely(__pyx_t_4)) {
8073 __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 153, __pyx_L1_error)
8074 __Pyx_GOTREF(__pyx_t_5);
8075 __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 153, __pyx_L1_error)
8076 __Pyx_GOTREF(__pyx_t_6);
8077 __pyx_t_10 = PyTuple_New(2);
if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 153, __pyx_L1_error)
8078 __Pyx_GOTREF(__pyx_t_10);
8079 __Pyx_GIVEREF(__pyx_t_5);
8080 PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5);
8081 __Pyx_GIVEREF(__pyx_t_6);
8082 PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6);
8085 __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_t_10);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 153, __pyx_L1_error)
8086 __Pyx_GOTREF(__pyx_t_6);
8087 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
8088 __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6);
if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 153, __pyx_L1_error)
8089 __Pyx_GOTREF(__pyx_t_10);
8090 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8091 __Pyx_Raise(__pyx_t_10, 0, 0, 0);
8092 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
8093 __PYX_ERR(1, 153, __pyx_L1_error)
8111 (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim;
8121 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8130 __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ));
if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 157, __pyx_L1_error)
8140 __pyx_v_order =
'F';
8149 __Pyx_INCREF(__pyx_n_u_fortran);
8150 __Pyx_GIVEREF(__pyx_n_u_fortran);
8151 __Pyx_GOTREF(__pyx_v_self->mode);
8152 __Pyx_DECREF(__pyx_v_self->mode);
8153 __pyx_v_self->mode = __pyx_n_u_fortran;
8172 __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ));
if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 160, __pyx_L1_error)
8173 if (likely(__pyx_t_4)) {
8182 __pyx_v_order =
'C';
8191 __Pyx_INCREF(__pyx_n_u_c);
8192 __Pyx_GIVEREF(__pyx_n_u_c);
8193 __Pyx_GOTREF(__pyx_v_self->mode);
8194 __Pyx_DECREF(__pyx_v_self->mode);
8195 __pyx_v_self->mode = __pyx_n_u_c;
8215 __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_v_mode);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 164, __pyx_L1_error)
8216 __Pyx_GOTREF(__pyx_t_3);
8217 __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3);
if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 164, __pyx_L1_error)
8218 __Pyx_GOTREF(__pyx_t_10);
8219 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8220 __Pyx_Raise(__pyx_t_10, 0, 0, 0);
8221 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
8222 __PYX_ERR(1, 164, __pyx_L1_error)
8233 __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order);
8242 __pyx_v_self->free_data = __pyx_v_allocate_buffer;
8251 __pyx_t_10 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_10);
if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 170, __pyx_L1_error)
8252 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10);
if (unlikely((__pyx_t_4 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 170, __pyx_L1_error)
8253 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
8254 __pyx_v_self->dtype_is_object = __pyx_t_4;
8263 __pyx_t_4 = (__pyx_v_allocate_buffer != 0);
8273 __pyx_v_self->data = ((
char *)malloc(__pyx_v_self->len));
8282 __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0);
8283 if (unlikely(__pyx_t_4)) {
8292 __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__14, NULL);
if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 176, __pyx_L1_error)
8293 __Pyx_GOTREF(__pyx_t_10);
8294 __Pyx_Raise(__pyx_t_10, 0, 0, 0);
8295 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
8296 __PYX_ERR(1, 176, __pyx_L1_error)
8314 __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0);
8324 __pyx_v_p = ((PyObject **)__pyx_v_self->data);
8333 if (unlikely(__pyx_v_itemsize == 0)) {
8334 PyErr_SetString(PyExc_ZeroDivisionError,
"integer division or modulo by zero");
8335 __PYX_ERR(1, 180, __pyx_L1_error)
8337 else if (
sizeof(Py_ssize_t) ==
sizeof(
long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) {
8338 PyErr_SetString(PyExc_OverflowError,
"value too large to perform division");
8339 __PYX_ERR(1, 180, __pyx_L1_error)
8341 __pyx_t_1 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_itemsize);
8342 __pyx_t_9 = __pyx_t_1;
8343 for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
8344 __pyx_v_i = __pyx_t_11;
8353 (__pyx_v_p[__pyx_v_i]) = Py_None;
8395 __Pyx_XDECREF(__pyx_t_3);
8396 __Pyx_XDECREF(__pyx_t_5);
8397 __Pyx_XDECREF(__pyx_t_6);
8398 __Pyx_XDECREF(__pyx_t_10);
8399 __Pyx_AddTraceback(
"View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8402 __Pyx_XDECREF(__pyx_v_format);
8403 __Pyx_RefNannyFinishContext();
8416 static CYTHON_UNUSED
int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
8417 static CYTHON_UNUSED
int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags) {
8419 __Pyx_RefNannyDeclarations
8420 __Pyx_RefNannySetupContext(
"__getbuffer__ (wrapper)", 0);
8421 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((
struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((
int)__pyx_v_flags));
8424 __Pyx_RefNannyFinishContext();
8428 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(
struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags) {
8429 int __pyx_v_bufmode;
8431 __Pyx_RefNannyDeclarations
8434 PyObject *__pyx_t_3 = NULL;
8436 Py_ssize_t __pyx_t_5;
8438 Py_ssize_t *__pyx_t_7;
8439 int __pyx_lineno = 0;
8440 const char *__pyx_filename = NULL;
8441 int __pyx_clineno = 0;
8442 if (__pyx_v_info == NULL) {
8443 PyErr_SetString(PyExc_BufferError,
"PyObject_GetBuffer: view==NULL argument is obsolete");
8446 __Pyx_RefNannySetupContext(
"__getbuffer__", 0);
8447 __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
8448 __Pyx_GIVEREF(__pyx_v_info->obj);
8457 __pyx_v_bufmode = -1;
8466 __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ));
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 187, __pyx_L1_error)
8467 __pyx_t_2 = (__pyx_t_1 != 0);
8477 __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
8496 __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ));
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 189, __pyx_L1_error)
8497 __pyx_t_1 = (__pyx_t_2 != 0);
8507 __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
8526 __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
8527 if (unlikely(__pyx_t_1)) {
8536 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__15, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 192, __pyx_L1_error)
8537 __Pyx_GOTREF(__pyx_t_3);
8538 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
8539 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8540 __PYX_ERR(1, 192, __pyx_L1_error)
8558 __pyx_t_4 = __pyx_v_self->data;
8559 __pyx_v_info->buf = __pyx_t_4;
8568 __pyx_t_5 = __pyx_v_self->len;
8569 __pyx_v_info->len = __pyx_t_5;
8578 __pyx_t_6 = __pyx_v_self->ndim;
8579 __pyx_v_info->ndim = __pyx_t_6;
8588 __pyx_t_7 = __pyx_v_self->_shape;
8589 __pyx_v_info->shape = __pyx_t_7;
8598 __pyx_t_7 = __pyx_v_self->_strides;
8599 __pyx_v_info->strides = __pyx_t_7;
8608 __pyx_v_info->suboffsets = NULL;
8617 __pyx_t_5 = __pyx_v_self->itemsize;
8618 __pyx_v_info->itemsize = __pyx_t_5;
8627 __pyx_v_info->readonly = 0;
8636 __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
8646 __pyx_t_4 = __pyx_v_self->format;
8647 __pyx_v_info->format = __pyx_t_4;
8667 __pyx_v_info->format = NULL;
8678 __Pyx_INCREF(((PyObject *)__pyx_v_self));
8679 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
8680 __Pyx_GOTREF(__pyx_v_info->obj);
8681 __Pyx_DECREF(__pyx_v_info->obj);
8682 __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
8696 __Pyx_XDECREF(__pyx_t_3);
8697 __Pyx_AddTraceback(
"View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8699 if (__pyx_v_info->obj != NULL) {
8700 __Pyx_GOTREF(__pyx_v_info->obj);
8701 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
8705 if (__pyx_v_info->obj == Py_None) {
8706 __Pyx_GOTREF(__pyx_v_info->obj);
8707 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
8710 __Pyx_RefNannyFinishContext();
8723 static void __pyx_array___dealloc__(PyObject *__pyx_v_self);
8724 static void __pyx_array___dealloc__(PyObject *__pyx_v_self) {
8725 __Pyx_RefNannyDeclarations
8726 __Pyx_RefNannySetupContext(
"__dealloc__ (wrapper)", 0);
8727 __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((
struct __pyx_array_obj *)__pyx_v_self));
8730 __Pyx_RefNannyFinishContext();
8733 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(
struct __pyx_array_obj *__pyx_v_self) {
8734 __Pyx_RefNannyDeclarations
8736 __Pyx_RefNannySetupContext(
"__dealloc__", 0);
8745 __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
8755 __pyx_v_self->callback_free_data(__pyx_v_self->data);
8774 __pyx_t_1 = (__pyx_v_self->free_data != 0);
8784 __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
8794 __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0);
8812 free(__pyx_v_self->data);
8831 PyObject_Free(__pyx_v_self->_shape);
8842 __Pyx_RefNannyFinishContext();
8854 static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self);
8855 static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) {
8856 PyObject *__pyx_r = 0;
8857 __Pyx_RefNannyDeclarations
8858 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
8859 __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((
struct __pyx_array_obj *)__pyx_v_self));
8862 __Pyx_RefNannyFinishContext();
8866 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(
struct __pyx_array_obj *__pyx_v_self) {
8867 PyObject *__pyx_r = NULL;
8868 __Pyx_RefNannyDeclarations
8869 PyObject *__pyx_t_1 = NULL;
8870 int __pyx_lineno = 0;
8871 const char *__pyx_filename = NULL;
8872 int __pyx_clineno = 0;
8873 __Pyx_RefNannySetupContext(
"__get__", 0);
8882 __Pyx_XDECREF(__pyx_r);
8883 __pyx_t_1 = ((
struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 223, __pyx_L1_error)
8884 __Pyx_GOTREF(__pyx_t_1);
8885 __pyx_r = __pyx_t_1;
8899 __Pyx_XDECREF(__pyx_t_1);
8900 __Pyx_AddTraceback(
"View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8903 __Pyx_XGIVEREF(__pyx_r);
8904 __Pyx_RefNannyFinishContext();
8916 static PyObject *__pyx_array_get_memview(
struct __pyx_array_obj *__pyx_v_self) {
8918 PyObject *__pyx_r = NULL;
8919 __Pyx_RefNannyDeclarations
8920 PyObject *__pyx_t_1 = NULL;
8921 PyObject *__pyx_t_2 = NULL;
8922 PyObject *__pyx_t_3 = NULL;
8923 int __pyx_lineno = 0;
8924 const char *__pyx_filename = NULL;
8925 int __pyx_clineno = 0;
8926 __Pyx_RefNannySetupContext(
"get_memview", 0);
8935 __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE);
8944 __Pyx_XDECREF(__pyx_r);
8945 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 228, __pyx_L1_error)
8946 __Pyx_GOTREF(__pyx_t_1);
8947 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 228, __pyx_L1_error)
8948 __Pyx_GOTREF(__pyx_t_2);
8949 __pyx_t_3 = PyTuple_New(3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 228, __pyx_L1_error)
8950 __Pyx_GOTREF(__pyx_t_3);
8951 __Pyx_INCREF(((PyObject *)__pyx_v_self));
8952 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
8953 PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self));
8954 __Pyx_GIVEREF(__pyx_t_1);
8955 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
8956 __Pyx_GIVEREF(__pyx_t_2);
8957 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
8960 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 228, __pyx_L1_error)
8961 __Pyx_GOTREF(__pyx_t_2);
8962 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8963 __pyx_r = __pyx_t_2;
8977 __Pyx_XDECREF(__pyx_t_1);
8978 __Pyx_XDECREF(__pyx_t_2);
8979 __Pyx_XDECREF(__pyx_t_3);
8980 __Pyx_AddTraceback(
"View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
8983 __Pyx_XGIVEREF(__pyx_r);
8984 __Pyx_RefNannyFinishContext();
8997 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self);
8998 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) {
9000 __Pyx_RefNannyDeclarations
9001 __Pyx_RefNannySetupContext(
"__len__ (wrapper)", 0);
9002 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((
struct __pyx_array_obj *)__pyx_v_self));
9005 __Pyx_RefNannyFinishContext();
9009 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(
struct __pyx_array_obj *__pyx_v_self) {
9011 __Pyx_RefNannyDeclarations
9012 __Pyx_RefNannySetupContext(
"__len__", 0);
9021 __pyx_r = (__pyx_v_self->_shape[0]);
9034 __Pyx_RefNannyFinishContext();
9047 static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr);
9048 static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) {
9049 PyObject *__pyx_r = 0;
9050 __Pyx_RefNannyDeclarations
9051 __Pyx_RefNannySetupContext(
"__getattr__ (wrapper)", 0);
9052 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((
struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr));
9055 __Pyx_RefNannyFinishContext();
9059 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) {
9060 PyObject *__pyx_r = NULL;
9061 __Pyx_RefNannyDeclarations
9062 PyObject *__pyx_t_1 = NULL;
9063 PyObject *__pyx_t_2 = NULL;
9064 int __pyx_lineno = 0;
9065 const char *__pyx_filename = NULL;
9066 int __pyx_clineno = 0;
9067 __Pyx_RefNannySetupContext(
"__getattr__", 0);
9076 __Pyx_XDECREF(__pyx_r);
9077 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 234, __pyx_L1_error)
9078 __Pyx_GOTREF(__pyx_t_1);
9079 __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 234, __pyx_L1_error)
9080 __Pyx_GOTREF(__pyx_t_2);
9081 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9082 __pyx_r = __pyx_t_2;
9096 __Pyx_XDECREF(__pyx_t_1);
9097 __Pyx_XDECREF(__pyx_t_2);
9098 __Pyx_AddTraceback(
"View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9101 __Pyx_XGIVEREF(__pyx_r);
9102 __Pyx_RefNannyFinishContext();
9115 static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item);
9116 static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
9117 PyObject *__pyx_r = 0;
9118 __Pyx_RefNannyDeclarations
9119 __Pyx_RefNannySetupContext(
"__getitem__ (wrapper)", 0);
9120 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((
struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item));
9123 __Pyx_RefNannyFinishContext();
9127 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) {
9128 PyObject *__pyx_r = NULL;
9129 __Pyx_RefNannyDeclarations
9130 PyObject *__pyx_t_1 = NULL;
9131 PyObject *__pyx_t_2 = NULL;
9132 int __pyx_lineno = 0;
9133 const char *__pyx_filename = NULL;
9134 int __pyx_clineno = 0;
9135 __Pyx_RefNannySetupContext(
"__getitem__", 0);
9144 __Pyx_XDECREF(__pyx_r);
9145 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 237, __pyx_L1_error)
9146 __Pyx_GOTREF(__pyx_t_1);
9147 __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 237, __pyx_L1_error)
9148 __Pyx_GOTREF(__pyx_t_2);
9149 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9150 __pyx_r = __pyx_t_2;
9164 __Pyx_XDECREF(__pyx_t_1);
9165 __Pyx_XDECREF(__pyx_t_2);
9166 __Pyx_AddTraceback(
"View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9169 __Pyx_XGIVEREF(__pyx_r);
9170 __Pyx_RefNannyFinishContext();
9183 static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value);
9184 static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
9186 __Pyx_RefNannyDeclarations
9187 __Pyx_RefNannySetupContext(
"__setitem__ (wrapper)", 0);
9188 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((
struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value));
9191 __Pyx_RefNannyFinishContext();
9195 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
9197 __Pyx_RefNannyDeclarations
9198 PyObject *__pyx_t_1 = NULL;
9199 int __pyx_lineno = 0;
9200 const char *__pyx_filename = NULL;
9201 int __pyx_clineno = 0;
9202 __Pyx_RefNannySetupContext(
"__setitem__", 0);
9211 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 240, __pyx_L1_error)
9212 __Pyx_GOTREF(__pyx_t_1);
9213 if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(1, 240, __pyx_L1_error)
9214 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9228 __Pyx_XDECREF(__pyx_t_1);
9229 __Pyx_AddTraceback(
"View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9232 __Pyx_RefNannyFinishContext();
9243 static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
9244 static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
9245 PyObject *__pyx_r = 0;
9246 __Pyx_RefNannyDeclarations
9247 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
9248 __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((
struct __pyx_array_obj *)__pyx_v_self));
9251 __Pyx_RefNannyFinishContext();
9255 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED
struct __pyx_array_obj *__pyx_v_self) {
9256 PyObject *__pyx_r = NULL;
9257 __Pyx_RefNannyDeclarations
9258 PyObject *__pyx_t_1 = NULL;
9259 int __pyx_lineno = 0;
9260 const char *__pyx_filename = NULL;
9261 int __pyx_clineno = 0;
9262 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
9270 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__16, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
9271 __Pyx_GOTREF(__pyx_t_1);
9272 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
9273 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9274 __PYX_ERR(1, 2, __pyx_L1_error)
9284 __Pyx_XDECREF(__pyx_t_1);
9285 __Pyx_AddTraceback(
"View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9287 __Pyx_XGIVEREF(__pyx_r);
9288 __Pyx_RefNannyFinishContext();
9300 static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
9301 static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
9302 PyObject *__pyx_r = 0;
9303 __Pyx_RefNannyDeclarations
9304 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
9305 __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((
struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
9308 __Pyx_RefNannyFinishContext();
9312 static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
9313 PyObject *__pyx_r = NULL;
9314 __Pyx_RefNannyDeclarations
9315 PyObject *__pyx_t_1 = NULL;
9316 int __pyx_lineno = 0;
9317 const char *__pyx_filename = NULL;
9318 int __pyx_clineno = 0;
9319 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
9326 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__17, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
9327 __Pyx_GOTREF(__pyx_t_1);
9328 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
9329 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9330 __PYX_ERR(1, 4, __pyx_L1_error)
9341 __Pyx_XDECREF(__pyx_t_1);
9342 __Pyx_AddTraceback(
"View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9344 __Pyx_XGIVEREF(__pyx_r);
9345 __Pyx_RefNannyFinishContext();
9357 static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize,
char *__pyx_v_format,
char *__pyx_v_mode,
char *__pyx_v_buf) {
9358 struct __pyx_array_obj *__pyx_v_result = 0;
9359 struct __pyx_array_obj *__pyx_r = NULL;
9360 __Pyx_RefNannyDeclarations
9362 PyObject *__pyx_t_2 = NULL;
9363 PyObject *__pyx_t_3 = NULL;
9364 PyObject *__pyx_t_4 = NULL;
9365 PyObject *__pyx_t_5 = NULL;
9366 int __pyx_lineno = 0;
9367 const char *__pyx_filename = NULL;
9368 int __pyx_clineno = 0;
9369 __Pyx_RefNannySetupContext(
"array_cwrapper", 0);
9378 __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
9388 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 249, __pyx_L1_error)
9389 __Pyx_GOTREF(__pyx_t_2);
9390 __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 249, __pyx_L1_error)
9391 __Pyx_GOTREF(__pyx_t_3);
9392 __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 249, __pyx_L1_error)
9393 __Pyx_GOTREF(__pyx_t_4);
9394 __pyx_t_5 = PyTuple_New(4);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 249, __pyx_L1_error)
9395 __Pyx_GOTREF(__pyx_t_5);
9396 __Pyx_INCREF(__pyx_v_shape);
9397 __Pyx_GIVEREF(__pyx_v_shape);
9398 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape);
9399 __Pyx_GIVEREF(__pyx_t_2);
9400 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
9401 __Pyx_GIVEREF(__pyx_t_3);
9402 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
9403 __Pyx_GIVEREF(__pyx_t_4);
9404 PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
9408 __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 249, __pyx_L1_error)
9409 __Pyx_GOTREF(__pyx_t_4);
9410 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9411 __pyx_v_result = ((
struct __pyx_array_obj *)__pyx_t_4);
9432 __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 251, __pyx_L1_error)
9433 __Pyx_GOTREF(__pyx_t_4);
9434 __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 251, __pyx_L1_error)
9435 __Pyx_GOTREF(__pyx_t_5);
9436 __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 251, __pyx_L1_error)
9437 __Pyx_GOTREF(__pyx_t_3);
9438 __pyx_t_2 = PyTuple_New(4);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 251, __pyx_L1_error)
9439 __Pyx_GOTREF(__pyx_t_2);
9440 __Pyx_INCREF(__pyx_v_shape);
9441 __Pyx_GIVEREF(__pyx_v_shape);
9442 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape);
9443 __Pyx_GIVEREF(__pyx_t_4);
9444 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
9445 __Pyx_GIVEREF(__pyx_t_5);
9446 PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
9447 __Pyx_GIVEREF(__pyx_t_3);
9448 PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3);
9460 __pyx_t_3 = __Pyx_PyDict_NewPresized(1);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 252, __pyx_L1_error)
9461 __Pyx_GOTREF(__pyx_t_3);
9462 if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(1, 252, __pyx_L1_error)
9471 __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_2, __pyx_t_3);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 251, __pyx_L1_error)
9472 __Pyx_GOTREF(__pyx_t_5);
9473 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9474 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9475 __pyx_v_result = ((
struct __pyx_array_obj *)__pyx_t_5);
9485 __pyx_v_result->data = __pyx_v_buf;
9496 __Pyx_XDECREF(((PyObject *)__pyx_r));
9497 __Pyx_INCREF(((PyObject *)__pyx_v_result));
9498 __pyx_r = __pyx_v_result;
9511 __Pyx_XDECREF(__pyx_t_2);
9512 __Pyx_XDECREF(__pyx_t_3);
9513 __Pyx_XDECREF(__pyx_t_4);
9514 __Pyx_XDECREF(__pyx_t_5);
9515 __Pyx_AddTraceback(
"View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
9518 __Pyx_XDECREF((PyObject *)__pyx_v_result);
9519 __Pyx_XGIVEREF((PyObject *)__pyx_r);
9520 __Pyx_RefNannyFinishContext();
9533 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
9534 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
9535 PyObject *__pyx_v_name = 0;
9536 int __pyx_lineno = 0;
9537 const char *__pyx_filename = NULL;
9538 int __pyx_clineno = 0;
9540 __Pyx_RefNannyDeclarations
9541 __Pyx_RefNannySetupContext(
"__init__ (wrapper)", 0);
9543 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
9544 PyObject* values[1] = {0};
9545 if (unlikely(__pyx_kwds)) {
9547 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
9549 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9552 default:
goto __pyx_L5_argtuple_error;
9554 kw_args = PyDict_Size(__pyx_kwds);
9557 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
9558 else goto __pyx_L5_argtuple_error;
9560 if (unlikely(kw_args > 0)) {
9561 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__init__") < 0)) __PYX_ERR(1, 281, __pyx_L3_error)
9563 }
else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
9564 goto __pyx_L5_argtuple_error;
9566 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9568 __pyx_v_name = values[0];
9570 goto __pyx_L4_argument_unpacking_done;
9571 __pyx_L5_argtuple_error:;
9572 __Pyx_RaiseArgtupleInvalid(
"__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 281, __pyx_L3_error)
9574 __Pyx_AddTraceback(
"View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9575 __Pyx_RefNannyFinishContext();
9577 __pyx_L4_argument_unpacking_done:;
9578 __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((
struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name);
9581 __Pyx_RefNannyFinishContext();
9585 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(
struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) {
9587 __Pyx_RefNannyDeclarations
9588 __Pyx_RefNannySetupContext(
"__init__", 0);
9597 __Pyx_INCREF(__pyx_v_name);
9598 __Pyx_GIVEREF(__pyx_v_name);
9599 __Pyx_GOTREF(__pyx_v_self->name);
9600 __Pyx_DECREF(__pyx_v_self->name);
9601 __pyx_v_self->name = __pyx_v_name;
9613 __Pyx_RefNannyFinishContext();
9626 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self);
9627 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) {
9628 PyObject *__pyx_r = 0;
9629 __Pyx_RefNannyDeclarations
9630 __Pyx_RefNannySetupContext(
"__repr__ (wrapper)", 0);
9631 __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((
struct __pyx_MemviewEnum_obj *)__pyx_v_self));
9634 __Pyx_RefNannyFinishContext();
9638 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(
struct __pyx_MemviewEnum_obj *__pyx_v_self) {
9639 PyObject *__pyx_r = NULL;
9640 __Pyx_RefNannyDeclarations
9641 __Pyx_RefNannySetupContext(
"__repr__", 0);
9650 __Pyx_XDECREF(__pyx_r);
9651 __Pyx_INCREF(__pyx_v_self->name);
9652 __pyx_r = __pyx_v_self->name;
9665 __Pyx_XGIVEREF(__pyx_r);
9666 __Pyx_RefNannyFinishContext();
9677 static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
9678 static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
9679 PyObject *__pyx_r = 0;
9680 __Pyx_RefNannyDeclarations
9681 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
9682 __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((
struct __pyx_MemviewEnum_obj *)__pyx_v_self));
9685 __Pyx_RefNannyFinishContext();
9689 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(
struct __pyx_MemviewEnum_obj *__pyx_v_self) {
9690 PyObject *__pyx_v_state = 0;
9691 PyObject *__pyx_v__dict = 0;
9692 int __pyx_v_use_setstate;
9693 PyObject *__pyx_r = NULL;
9694 __Pyx_RefNannyDeclarations
9695 PyObject *__pyx_t_1 = NULL;
9698 PyObject *__pyx_t_4 = NULL;
9699 PyObject *__pyx_t_5 = NULL;
9700 int __pyx_lineno = 0;
9701 const char *__pyx_filename = NULL;
9702 int __pyx_clineno = 0;
9703 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
9712 __pyx_t_1 = PyTuple_New(1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
9713 __Pyx_GOTREF(__pyx_t_1);
9714 __Pyx_INCREF(__pyx_v_self->name);
9715 __Pyx_GIVEREF(__pyx_v_self->name);
9716 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name);
9717 __pyx_v_state = ((PyObject*)__pyx_t_1);
9727 __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
9728 __Pyx_GOTREF(__pyx_t_1);
9729 __pyx_v__dict = __pyx_t_1;
9739 __pyx_t_2 = (__pyx_v__dict != Py_None);
9740 __pyx_t_3 = (__pyx_t_2 != 0);
9750 __pyx_t_1 = PyTuple_New(1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
9751 __Pyx_GOTREF(__pyx_t_1);
9752 __Pyx_INCREF(__pyx_v__dict);
9753 __Pyx_GIVEREF(__pyx_v__dict);
9754 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
9755 __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
9756 __Pyx_GOTREF(__pyx_t_4);
9757 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9758 __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
9768 __pyx_v_use_setstate = 1;
9788 __pyx_t_3 = (__pyx_v_self->name != Py_None);
9789 __pyx_v_use_setstate = __pyx_t_3;
9800 __pyx_t_3 = (__pyx_v_use_setstate != 0);
9810 __Pyx_XDECREF(__pyx_r);
9811 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
9812 __Pyx_GOTREF(__pyx_t_4);
9813 __pyx_t_1 = PyTuple_New(3);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
9814 __Pyx_GOTREF(__pyx_t_1);
9815 __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
9816 __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
9817 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
9818 __Pyx_INCREF(__pyx_int_184977713);
9819 __Pyx_GIVEREF(__pyx_int_184977713);
9820 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
9821 __Pyx_INCREF(Py_None);
9822 __Pyx_GIVEREF(Py_None);
9823 PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
9824 __pyx_t_5 = PyTuple_New(3);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
9825 __Pyx_GOTREF(__pyx_t_5);
9826 __Pyx_GIVEREF(__pyx_t_4);
9827 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
9828 __Pyx_GIVEREF(__pyx_t_1);
9829 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
9830 __Pyx_INCREF(__pyx_v_state);
9831 __Pyx_GIVEREF(__pyx_v_state);
9832 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
9835 __pyx_r = __pyx_t_5;
9856 __Pyx_XDECREF(__pyx_r);
9857 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Enum);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
9858 __Pyx_GOTREF(__pyx_t_5);
9859 __pyx_t_1 = PyTuple_New(3);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
9860 __Pyx_GOTREF(__pyx_t_1);
9861 __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
9862 __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
9863 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
9864 __Pyx_INCREF(__pyx_int_184977713);
9865 __Pyx_GIVEREF(__pyx_int_184977713);
9866 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
9867 __Pyx_INCREF(__pyx_v_state);
9868 __Pyx_GIVEREF(__pyx_v_state);
9869 PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
9870 __pyx_t_4 = PyTuple_New(2);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
9871 __Pyx_GOTREF(__pyx_t_4);
9872 __Pyx_GIVEREF(__pyx_t_5);
9873 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
9874 __Pyx_GIVEREF(__pyx_t_1);
9875 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
9878 __pyx_r = __pyx_t_4;
9891 __Pyx_XDECREF(__pyx_t_1);
9892 __Pyx_XDECREF(__pyx_t_4);
9893 __Pyx_XDECREF(__pyx_t_5);
9894 __Pyx_AddTraceback(
"View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9897 __Pyx_XDECREF(__pyx_v_state);
9898 __Pyx_XDECREF(__pyx_v__dict);
9899 __Pyx_XGIVEREF(__pyx_r);
9900 __Pyx_RefNannyFinishContext();
9912 static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
9913 static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
9914 PyObject *__pyx_r = 0;
9915 __Pyx_RefNannyDeclarations
9916 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
9917 __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((
struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
9920 __Pyx_RefNannyFinishContext();
9924 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(
struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
9925 PyObject *__pyx_r = NULL;
9926 __Pyx_RefNannyDeclarations
9927 PyObject *__pyx_t_1 = NULL;
9928 int __pyx_lineno = 0;
9929 const char *__pyx_filename = NULL;
9930 int __pyx_clineno = 0;
9931 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
9938 if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError,
"Expected %.16s, got %.200s",
"tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
9939 __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state));
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
9940 __Pyx_GOTREF(__pyx_t_1);
9941 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9951 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9954 __Pyx_XDECREF(__pyx_t_1);
9955 __Pyx_AddTraceback(
"View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9958 __Pyx_XGIVEREF(__pyx_r);
9959 __Pyx_RefNannyFinishContext();
9971 static void *__pyx_align_pointer(
void *__pyx_v_memory,
size_t __pyx_v_alignment) {
9972 Py_intptr_t __pyx_v_aligned_p;
9973 size_t __pyx_v_offset;
9984 __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory);
9993 __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment);
10002 __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
10012 __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset));
10030 __pyx_r = ((
void *)__pyx_v_aligned_p);
10055 static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
10056 static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
10057 PyObject *__pyx_v_obj = 0;
10059 int __pyx_v_dtype_is_object;
10060 int __pyx_lineno = 0;
10061 const char *__pyx_filename = NULL;
10062 int __pyx_clineno = 0;
10064 __Pyx_RefNannyDeclarations
10065 __Pyx_RefNannySetupContext(
"__cinit__ (wrapper)", 0);
10067 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0};
10068 PyObject* values[3] = {0,0,0};
10069 if (unlikely(__pyx_kwds)) {
10070 Py_ssize_t kw_args;
10071 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
10072 switch (pos_args) {
10073 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
10074 CYTHON_FALLTHROUGH;
10075 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
10076 CYTHON_FALLTHROUGH;
10077 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10078 CYTHON_FALLTHROUGH;
10080 default:
goto __pyx_L5_argtuple_error;
10082 kw_args = PyDict_Size(__pyx_kwds);
10083 switch (pos_args) {
10085 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--;
10086 else goto __pyx_L5_argtuple_error;
10087 CYTHON_FALLTHROUGH;
10089 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--;
10091 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 2, 3, 1); __PYX_ERR(1, 345, __pyx_L3_error)
10093 CYTHON_FALLTHROUGH;
10096 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype_is_object);
10097 if (value) { values[2] = value; kw_args--; }
10100 if (unlikely(kw_args > 0)) {
10101 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__cinit__") < 0)) __PYX_ERR(1, 345, __pyx_L3_error)
10104 switch (PyTuple_GET_SIZE(__pyx_args)) {
10105 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
10106 CYTHON_FALLTHROUGH;
10107 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
10108 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10110 default:
goto __pyx_L5_argtuple_error;
10113 __pyx_v_obj = values[0];
10114 __pyx_v_flags = __Pyx_PyInt_As_int(values[1]);
if (unlikely((__pyx_v_flags == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 345, __pyx_L3_error)
10116 __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]);
if (unlikely((__pyx_v_dtype_is_object == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 345, __pyx_L3_error)
10118 __pyx_v_dtype_is_object = ((int)0);
10121 goto __pyx_L4_argument_unpacking_done;
10122 __pyx_L5_argtuple_error:;
10123 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 345, __pyx_L3_error)
10125 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10126 __Pyx_RefNannyFinishContext();
10128 __pyx_L4_argument_unpacking_done:;
10129 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((
struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object);
10132 __Pyx_RefNannyFinishContext();
10136 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj,
int __pyx_v_flags,
int __pyx_v_dtype_is_object) {
10138 __Pyx_RefNannyDeclarations
10143 int __pyx_lineno = 0;
10144 const char *__pyx_filename = NULL;
10145 int __pyx_clineno = 0;
10146 __Pyx_RefNannySetupContext(
"__cinit__", 0);
10155 __Pyx_INCREF(__pyx_v_obj);
10156 __Pyx_GIVEREF(__pyx_v_obj);
10157 __Pyx_GOTREF(__pyx_v_self->obj);
10158 __Pyx_DECREF(__pyx_v_self->obj);
10159 __pyx_v_self->obj = __pyx_v_obj;
10168 __pyx_v_self->flags = __pyx_v_flags;
10177 __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type));
10178 __pyx_t_3 = (__pyx_t_2 != 0);
10181 __pyx_t_1 = __pyx_t_3;
10182 goto __pyx_L4_bool_binop_done;
10184 __pyx_t_3 = (__pyx_v_obj != Py_None);
10185 __pyx_t_2 = (__pyx_t_3 != 0);
10186 __pyx_t_1 = __pyx_t_2;
10187 __pyx_L4_bool_binop_done:;
10197 __pyx_t_4 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags);
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(1, 349, __pyx_L1_error)
10206 __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
10216 ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None;
10225 Py_INCREF(Py_None);
10252 __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0);
10262 __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
10271 __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1);
10289 __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
10299 __pyx_v_self->lock = PyThread_allocate_lock();
10308 __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
10309 if (unlikely(__pyx_t_1)) {
10318 PyErr_NoMemory(); __PYX_ERR(1, 361, __pyx_L1_error)
10345 __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
10355 __pyx_t_2 = (((__pyx_v_self->view.format[0]) ==
'O') != 0);
10358 __pyx_t_1 = __pyx_t_2;
10359 goto __pyx_L11_bool_binop_done;
10361 __pyx_t_2 = (((__pyx_v_self->view.format[1]) ==
'\x00') != 0);
10362 __pyx_t_1 = __pyx_t_2;
10363 __pyx_L11_bool_binop_done:;
10364 __pyx_v_self->dtype_is_object = __pyx_t_1;
10384 __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object;
10395 __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((
void *)(&(__pyx_v_self->acquisition_count[0]))), (
sizeof(__pyx_atomic_int))));
10404 __pyx_v_self->typeinfo = NULL;
10418 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10421 __Pyx_RefNannyFinishContext();
10434 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self);
10435 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
10436 __Pyx_RefNannyDeclarations
10437 __Pyx_RefNannySetupContext(
"__dealloc__ (wrapper)", 0);
10438 __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
10441 __Pyx_RefNannyFinishContext();
10444 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(
struct __pyx_memoryview_obj *__pyx_v_self) {
10446 __Pyx_RefNannyDeclarations
10452 PyThread_type_lock __pyx_t_6;
10453 PyThread_type_lock __pyx_t_7;
10454 __Pyx_RefNannySetupContext(
"__dealloc__", 0);
10463 __pyx_t_1 = (__pyx_v_self->obj != Py_None);
10464 __pyx_t_2 = (__pyx_t_1 != 0);
10474 __Pyx_ReleaseBuffer((&__pyx_v_self->view));
10493 __pyx_t_2 = ((((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None) != 0);
10503 ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL;
10512 Py_DECREF(Py_None);
10531 __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
10541 __pyx_t_3 = __pyx_memoryview_thread_locks_used;
10542 __pyx_t_4 = __pyx_t_3;
10543 for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
10544 __pyx_v_i = __pyx_t_5;
10553 __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0);
10563 __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1);
10572 __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0);
10582 __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
10583 __pyx_t_7 = (__pyx_memoryview_thread_locks[__pyx_v_i]);
10592 (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_6;
10593 (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_7;
10611 goto __pyx_L6_break;
10631 PyThread_free_lock(__pyx_v_self->lock);
10653 __Pyx_RefNannyFinishContext();
10664 static char *__pyx_memoryview_get_item_pointer(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
10665 Py_ssize_t __pyx_v_dim;
10666 char *__pyx_v_itemp;
10667 PyObject *__pyx_v_idx = NULL;
10669 __Pyx_RefNannyDeclarations
10670 Py_ssize_t __pyx_t_1;
10671 PyObject *__pyx_t_2 = NULL;
10672 Py_ssize_t __pyx_t_3;
10673 PyObject *(*__pyx_t_4)(PyObject *);
10674 PyObject *__pyx_t_5 = NULL;
10675 Py_ssize_t __pyx_t_6;
10677 int __pyx_lineno = 0;
10678 const char *__pyx_filename = NULL;
10679 int __pyx_clineno = 0;
10680 __Pyx_RefNannySetupContext(
"get_item_pointer", 0);
10689 __pyx_v_itemp = ((
char *)__pyx_v_self->view.buf);
10699 if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) {
10700 __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
10703 __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 397, __pyx_L1_error)
10704 __Pyx_GOTREF(__pyx_t_2);
10705 __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 397, __pyx_L1_error)
10708 if (likely(!__pyx_t_4)) {
10709 if (likely(PyList_CheckExact(__pyx_t_2))) {
10710 if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2))
break;
10711 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10712 __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++;
if (unlikely(0 < 0)) __PYX_ERR(1, 397, __pyx_L1_error)
10714 __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++;
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 397, __pyx_L1_error)
10715 __Pyx_GOTREF(__pyx_t_5);
10718 if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2))
break;
10719 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10720 __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++;
if (unlikely(0 < 0)) __PYX_ERR(1, 397, __pyx_L1_error)
10722 __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++;
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 397, __pyx_L1_error)
10723 __Pyx_GOTREF(__pyx_t_5);
10727 __pyx_t_5 = __pyx_t_4(__pyx_t_2);
10728 if (unlikely(!__pyx_t_5)) {
10729 PyObject* exc_type = PyErr_Occurred();
10731 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
10732 else __PYX_ERR(1, 397, __pyx_L1_error)
10736 __Pyx_GOTREF(__pyx_t_5);
10738 __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
10740 __pyx_v_dim = __pyx_t_1;
10741 __pyx_t_1 = (__pyx_t_1 + 1);
10750 __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx);
if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 398, __pyx_L1_error)
10751 __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim);
if (unlikely(__pyx_t_7 == ((
char *)NULL))) __PYX_ERR(1, 398, __pyx_L1_error)
10752 __pyx_v_itemp = __pyx_t_7;
10762 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10771 __pyx_r = __pyx_v_itemp;
10784 __Pyx_XDECREF(__pyx_t_2);
10785 __Pyx_XDECREF(__pyx_t_5);
10786 __Pyx_AddTraceback(
"View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename);
10789 __Pyx_XDECREF(__pyx_v_idx);
10790 __Pyx_RefNannyFinishContext();
10803 static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index);
10804 static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
10805 PyObject *__pyx_r = 0;
10806 __Pyx_RefNannyDeclarations
10807 __Pyx_RefNannySetupContext(
"__getitem__ (wrapper)", 0);
10808 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((
struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index));
10811 __Pyx_RefNannyFinishContext();
10815 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
10816 PyObject *__pyx_v_have_slices = NULL;
10817 PyObject *__pyx_v_indices = NULL;
10818 char *__pyx_v_itemp;
10819 PyObject *__pyx_r = NULL;
10820 __Pyx_RefNannyDeclarations
10823 PyObject *__pyx_t_3 = NULL;
10824 PyObject *__pyx_t_4 = NULL;
10825 PyObject *__pyx_t_5 = NULL;
10827 int __pyx_lineno = 0;
10828 const char *__pyx_filename = NULL;
10829 int __pyx_clineno = 0;
10830 __Pyx_RefNannySetupContext(
"__getitem__", 0);
10839 __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
10840 __pyx_t_2 = (__pyx_t_1 != 0);
10850 __Pyx_XDECREF(__pyx_r);
10851 __Pyx_INCREF(((PyObject *)__pyx_v_self));
10852 __pyx_r = ((PyObject *)__pyx_v_self);
10871 __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 407, __pyx_L1_error)
10872 __Pyx_GOTREF(__pyx_t_3);
10873 if (likely(__pyx_t_3 != Py_None)) {
10874 PyObject* sequence = __pyx_t_3;
10875 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
10876 if (unlikely(size != 2)) {
10877 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
10878 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
10879 __PYX_ERR(1, 407, __pyx_L1_error)
10881 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10882 __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
10883 __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
10884 __Pyx_INCREF(__pyx_t_4);
10885 __Pyx_INCREF(__pyx_t_5);
10887 __pyx_t_4 = PySequence_ITEM(sequence, 0);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 407, __pyx_L1_error)
10888 __Pyx_GOTREF(__pyx_t_4);
10889 __pyx_t_5 = PySequence_ITEM(sequence, 1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 407, __pyx_L1_error)
10890 __Pyx_GOTREF(__pyx_t_5);
10892 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10894 __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 407, __pyx_L1_error)
10896 __pyx_v_have_slices = __pyx_t_4;
10898 __pyx_v_indices = __pyx_t_5;
10908 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices);
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 410, __pyx_L1_error)
10918 __Pyx_XDECREF(__pyx_r);
10919 __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices));
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 411, __pyx_L1_error)
10920 __Pyx_GOTREF(__pyx_t_3);
10921 __pyx_r = __pyx_t_3;
10942 __pyx_t_6 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices);
if (unlikely(__pyx_t_6 == ((
char *)NULL))) __PYX_ERR(1, 413, __pyx_L1_error)
10943 __pyx_v_itemp = __pyx_t_6;
10952 __Pyx_XDECREF(__pyx_r);
10953 __pyx_t_3 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 414, __pyx_L1_error)
10954 __Pyx_GOTREF(__pyx_t_3);
10955 __pyx_r = __pyx_t_3;
10970 __Pyx_XDECREF(__pyx_t_3);
10971 __Pyx_XDECREF(__pyx_t_4);
10972 __Pyx_XDECREF(__pyx_t_5);
10973 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10976 __Pyx_XDECREF(__pyx_v_have_slices);
10977 __Pyx_XDECREF(__pyx_v_indices);
10978 __Pyx_XGIVEREF(__pyx_r);
10979 __Pyx_RefNannyFinishContext();
10992 static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value);
10993 static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
10995 __Pyx_RefNannyDeclarations
10996 __Pyx_RefNannySetupContext(
"__setitem__ (wrapper)", 0);
10997 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((
struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value));
11000 __Pyx_RefNannyFinishContext();
11004 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
11005 PyObject *__pyx_v_have_slices = NULL;
11006 PyObject *__pyx_v_obj = NULL;
11008 __Pyx_RefNannyDeclarations
11010 PyObject *__pyx_t_2 = NULL;
11011 PyObject *__pyx_t_3 = NULL;
11012 PyObject *__pyx_t_4 = NULL;
11013 int __pyx_lineno = 0;
11014 const char *__pyx_filename = NULL;
11015 int __pyx_clineno = 0;
11016 __Pyx_RefNannySetupContext(
"__setitem__", 0);
11017 __Pyx_INCREF(__pyx_v_index);
11026 __pyx_t_1 = (__pyx_v_self->view.readonly != 0);
11027 if (unlikely(__pyx_t_1)) {
11036 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__18, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 418, __pyx_L1_error)
11037 __Pyx_GOTREF(__pyx_t_2);
11038 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
11039 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11040 __PYX_ERR(1, 418, __pyx_L1_error)
11058 __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 420, __pyx_L1_error)
11059 __Pyx_GOTREF(__pyx_t_2);
11060 if (likely(__pyx_t_2 != Py_None)) {
11061 PyObject* sequence = __pyx_t_2;
11062 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
11063 if (unlikely(size != 2)) {
11064 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
11065 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
11066 __PYX_ERR(1, 420, __pyx_L1_error)
11068 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
11069 __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
11070 __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
11071 __Pyx_INCREF(__pyx_t_3);
11072 __Pyx_INCREF(__pyx_t_4);
11074 __pyx_t_3 = PySequence_ITEM(sequence, 0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 420, __pyx_L1_error)
11075 __Pyx_GOTREF(__pyx_t_3);
11076 __pyx_t_4 = PySequence_ITEM(sequence, 1);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 420, __pyx_L1_error)
11077 __Pyx_GOTREF(__pyx_t_4);
11079 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11081 __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 420, __pyx_L1_error)
11083 __pyx_v_have_slices = __pyx_t_3;
11085 __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4);
11095 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 422, __pyx_L1_error)
11105 __pyx_t_2 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 423, __pyx_L1_error)
11106 __Pyx_GOTREF(__pyx_t_2);
11107 __pyx_v_obj = __pyx_t_2;
11117 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 424, __pyx_L1_error)
11127 __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 425, __pyx_L1_error)
11128 __Pyx_GOTREF(__pyx_t_2);
11129 __pyx_t_4 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_2, __pyx_v_obj);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 425, __pyx_L1_error)
11130 __Pyx_GOTREF(__pyx_t_4);
11131 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11132 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11152 __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 427, __pyx_L1_error)
11153 __Pyx_GOTREF(__pyx_t_4);
11154 if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(1, 427, __pyx_L1_error)
11155 __pyx_t_2 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((
struct __pyx_memoryview_obj *)__pyx_t_4), __pyx_v_value);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 427, __pyx_L1_error)
11156 __Pyx_GOTREF(__pyx_t_2);
11157 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11158 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11180 __pyx_t_2 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 429, __pyx_L1_error)
11181 __Pyx_GOTREF(__pyx_t_2);
11182 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11198 __Pyx_XDECREF(__pyx_t_2);
11199 __Pyx_XDECREF(__pyx_t_3);
11200 __Pyx_XDECREF(__pyx_t_4);
11201 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11204 __Pyx_XDECREF(__pyx_v_have_slices);
11205 __Pyx_XDECREF(__pyx_v_obj);
11206 __Pyx_XDECREF(__pyx_v_index);
11207 __Pyx_RefNannyFinishContext();
11219 static PyObject *__pyx_memoryview_is_slice(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
11220 PyObject *__pyx_r = NULL;
11221 __Pyx_RefNannyDeclarations
11224 PyObject *__pyx_t_3 = NULL;
11225 PyObject *__pyx_t_4 = NULL;
11226 PyObject *__pyx_t_5 = NULL;
11227 PyObject *__pyx_t_6 = NULL;
11228 PyObject *__pyx_t_7 = NULL;
11229 PyObject *__pyx_t_8 = NULL;
11231 int __pyx_lineno = 0;
11232 const char *__pyx_filename = NULL;
11233 int __pyx_clineno = 0;
11234 __Pyx_RefNannySetupContext(
"is_slice", 0);
11235 __Pyx_INCREF(__pyx_v_obj);
11244 __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type);
11245 __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
11256 __Pyx_PyThreadState_declare
11257 __Pyx_PyThreadState_assign
11258 __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
11259 __Pyx_XGOTREF(__pyx_t_3);
11260 __Pyx_XGOTREF(__pyx_t_4);
11261 __Pyx_XGOTREF(__pyx_t_5);
11271 __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS));
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 434, __pyx_L4_error)
11272 __Pyx_GOTREF(__pyx_t_6);
11281 __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object);
if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 435, __pyx_L4_error)
11282 __Pyx_GOTREF(__pyx_t_7);
11291 __pyx_t_8 = PyTuple_New(3);
if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 434, __pyx_L4_error)
11292 __Pyx_GOTREF(__pyx_t_8);
11293 __Pyx_INCREF(__pyx_v_obj);
11294 __Pyx_GIVEREF(__pyx_v_obj);
11295 PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
11296 __Pyx_GIVEREF(__pyx_t_6);
11297 PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
11298 __Pyx_GIVEREF(__pyx_t_7);
11299 PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
11302 __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL);
if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 434, __pyx_L4_error)
11303 __Pyx_GOTREF(__pyx_t_7);
11304 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11305 __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
11316 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
11317 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
11318 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11319 goto __pyx_L9_try_end;
11321 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
11322 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
11323 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
11332 __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
11334 __Pyx_AddTraceback(
"View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
11335 if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(1, 436, __pyx_L6_except_error)
11336 __Pyx_GOTREF(__pyx_t_7);
11337 __Pyx_GOTREF(__pyx_t_8);
11338 __Pyx_GOTREF(__pyx_t_6);
11347 __Pyx_XDECREF(__pyx_r);
11348 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11349 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11350 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11351 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11352 goto __pyx_L7_except_return;
11354 goto __pyx_L6_except_error;
11355 __pyx_L6_except_error:;
11364 __Pyx_XGIVEREF(__pyx_t_3);
11365 __Pyx_XGIVEREF(__pyx_t_4);
11366 __Pyx_XGIVEREF(__pyx_t_5);
11367 __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
11368 goto __pyx_L1_error;
11369 __pyx_L7_except_return:;
11370 __Pyx_XGIVEREF(__pyx_t_3);
11371 __Pyx_XGIVEREF(__pyx_t_4);
11372 __Pyx_XGIVEREF(__pyx_t_5);
11373 __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
11394 __Pyx_XDECREF(__pyx_r);
11395 __Pyx_INCREF(__pyx_v_obj);
11396 __pyx_r = __pyx_v_obj;
11409 __Pyx_XDECREF(__pyx_t_6);
11410 __Pyx_XDECREF(__pyx_t_7);
11411 __Pyx_XDECREF(__pyx_t_8);
11412 __Pyx_AddTraceback(
"View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
11415 __Pyx_XDECREF(__pyx_v_obj);
11416 __Pyx_XGIVEREF(__pyx_r);
11417 __Pyx_RefNannyFinishContext();
11429 static PyObject *__pyx_memoryview_setitem_slice_assignment(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) {
11430 __Pyx_memviewslice __pyx_v_dst_slice;
11431 __Pyx_memviewslice __pyx_v_src_slice;
11432 PyObject *__pyx_r = NULL;
11433 __Pyx_RefNannyDeclarations
11434 __Pyx_memviewslice *__pyx_t_1;
11435 __Pyx_memviewslice *__pyx_t_2;
11436 PyObject *__pyx_t_3 = NULL;
11440 int __pyx_lineno = 0;
11441 const char *__pyx_filename = NULL;
11442 int __pyx_clineno = 0;
11443 __Pyx_RefNannySetupContext(
"setitem_slice_assignment", 0);
11452 if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(1, 445, __pyx_L1_error)
11453 __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((
struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice));
if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 445, __pyx_L1_error)
11462 if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(1, 446, __pyx_L1_error)
11463 __pyx_t_2 = __pyx_memoryview_get_slice_from_memoryview(((
struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice));
if (unlikely(__pyx_t_2 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 446, __pyx_L1_error)
11472 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 447, __pyx_L1_error)
11473 __Pyx_GOTREF(__pyx_t_3);
11474 __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3);
if (unlikely((__pyx_t_4 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 447, __pyx_L1_error)
11475 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11476 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 447, __pyx_L1_error)
11477 __Pyx_GOTREF(__pyx_t_3);
11478 __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3);
if (unlikely((__pyx_t_5 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 447, __pyx_L1_error)
11479 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11488 __pyx_t_6 = __pyx_memoryview_copy_contents((__pyx_t_1[0]), (__pyx_t_2[0]), __pyx_t_4, __pyx_t_5, __pyx_v_self->dtype_is_object);
if (unlikely(__pyx_t_6 == ((
int)-1))) __PYX_ERR(1, 445, __pyx_L1_error)
11499 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11502 __Pyx_XDECREF(__pyx_t_3);
11503 __Pyx_AddTraceback(
"View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
11506 __Pyx_XGIVEREF(__pyx_r);
11507 __Pyx_RefNannyFinishContext();
11519 static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(
struct __pyx_memoryview_obj *__pyx_v_self,
struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) {
11520 int __pyx_v_array[0x80];
11522 void *__pyx_v_item;
11523 __Pyx_memviewslice *__pyx_v_dst_slice;
11524 __Pyx_memviewslice __pyx_v_tmp_slice;
11525 PyObject *__pyx_r = NULL;
11526 __Pyx_RefNannyDeclarations
11527 __Pyx_memviewslice *__pyx_t_1;
11529 PyObject *__pyx_t_3 = NULL;
11532 char const *__pyx_t_6;
11533 PyObject *__pyx_t_7 = NULL;
11534 PyObject *__pyx_t_8 = NULL;
11535 PyObject *__pyx_t_9 = NULL;
11536 PyObject *__pyx_t_10 = NULL;
11537 PyObject *__pyx_t_11 = NULL;
11538 PyObject *__pyx_t_12 = NULL;
11539 int __pyx_lineno = 0;
11540 const char *__pyx_filename = NULL;
11541 int __pyx_clineno = 0;
11542 __Pyx_RefNannySetupContext(
"setitem_slice_assign_scalar", 0);
11551 __pyx_v_tmp = NULL;
11560 __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice));
if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 456, __pyx_L1_error)
11561 __pyx_v_dst_slice = __pyx_t_1;
11570 __pyx_t_2 = ((((size_t)__pyx_v_self->view.itemsize) > (
sizeof(__pyx_v_array))) != 0);
11580 __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize);
11589 __pyx_t_2 = ((__pyx_v_tmp == NULL) != 0);
11590 if (unlikely(__pyx_t_2)) {
11599 PyErr_NoMemory(); __PYX_ERR(1, 461, __pyx_L1_error)
11617 __pyx_v_item = __pyx_v_tmp;
11637 __pyx_v_item = ((
void *)__pyx_v_array);
11657 __pyx_t_2 = (__pyx_v_self->dtype_is_object != 0);
11667 (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value);
11687 __pyx_t_3 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((
char *)__pyx_v_item), __pyx_v_value);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 470, __pyx_L6_error)
11688 __Pyx_GOTREF(__pyx_t_3);
11689 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11700 __pyx_t_2 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
11710 __pyx_t_3 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 475, __pyx_L6_error)
11711 __Pyx_GOTREF(__pyx_t_3);
11712 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11730 __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object);
11742 PyMem_Free(__pyx_v_tmp);
11747 __Pyx_PyThreadState_declare
11748 __Pyx_PyThreadState_assign
11749 __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
11750 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
11751 if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
11752 if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
11753 __Pyx_XGOTREF(__pyx_t_7);
11754 __Pyx_XGOTREF(__pyx_t_8);
11755 __Pyx_XGOTREF(__pyx_t_9);
11756 __Pyx_XGOTREF(__pyx_t_10);
11757 __Pyx_XGOTREF(__pyx_t_11);
11758 __Pyx_XGOTREF(__pyx_t_12);
11759 __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
11761 PyMem_Free(__pyx_v_tmp);
11763 if (PY_MAJOR_VERSION >= 3) {
11764 __Pyx_XGIVEREF(__pyx_t_10);
11765 __Pyx_XGIVEREF(__pyx_t_11);
11766 __Pyx_XGIVEREF(__pyx_t_12);
11767 __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
11769 __Pyx_XGIVEREF(__pyx_t_7);
11770 __Pyx_XGIVEREF(__pyx_t_8);
11771 __Pyx_XGIVEREF(__pyx_t_9);
11772 __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
11773 __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
11774 __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
11775 goto __pyx_L1_error;
11789 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11792 __Pyx_XDECREF(__pyx_t_3);
11793 __Pyx_AddTraceback(
"View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
11796 __Pyx_XGIVEREF(__pyx_r);
11797 __Pyx_RefNannyFinishContext();
11809 static PyObject *__pyx_memoryview_setitem_indexed(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
11810 char *__pyx_v_itemp;
11811 PyObject *__pyx_r = NULL;
11812 __Pyx_RefNannyDeclarations
11814 PyObject *__pyx_t_2 = NULL;
11815 int __pyx_lineno = 0;
11816 const char *__pyx_filename = NULL;
11817 int __pyx_clineno = 0;
11818 __Pyx_RefNannySetupContext(
"setitem_indexed", 0);
11827 __pyx_t_1 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index);
if (unlikely(__pyx_t_1 == ((
char *)NULL))) __PYX_ERR(1, 482, __pyx_L1_error)
11828 __pyx_v_itemp = __pyx_t_1;
11837 __pyx_t_2 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 483, __pyx_L1_error)
11838 __Pyx_GOTREF(__pyx_t_2);
11839 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11850 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11853 __Pyx_XDECREF(__pyx_t_2);
11854 __Pyx_AddTraceback(
"View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename);
11857 __Pyx_XGIVEREF(__pyx_r);
11858 __Pyx_RefNannyFinishContext();
11870 static PyObject *__pyx_memoryview_convert_item_to_object(
struct __pyx_memoryview_obj *__pyx_v_self,
char *__pyx_v_itemp) {
11871 PyObject *__pyx_v_struct = NULL;
11872 PyObject *__pyx_v_bytesitem = 0;
11873 PyObject *__pyx_v_result = NULL;
11874 PyObject *__pyx_r = NULL;
11875 __Pyx_RefNannyDeclarations
11876 PyObject *__pyx_t_1 = NULL;
11877 PyObject *__pyx_t_2 = NULL;
11878 PyObject *__pyx_t_3 = NULL;
11879 PyObject *__pyx_t_4 = NULL;
11880 PyObject *__pyx_t_5 = NULL;
11881 PyObject *__pyx_t_6 = NULL;
11882 PyObject *__pyx_t_7 = NULL;
11884 PyObject *__pyx_t_9 = NULL;
11887 int __pyx_lineno = 0;
11888 const char *__pyx_filename = NULL;
11889 int __pyx_clineno = 0;
11890 __Pyx_RefNannySetupContext(
"convert_item_to_object", 0);
11899 __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 488, __pyx_L1_error)
11900 __Pyx_GOTREF(__pyx_t_1);
11901 __pyx_v_struct = __pyx_t_1;
11911 __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 491, __pyx_L1_error)
11912 __Pyx_GOTREF(__pyx_t_1);
11913 __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
11924 __Pyx_PyThreadState_declare
11925 __Pyx_PyThreadState_assign
11926 __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
11927 __Pyx_XGOTREF(__pyx_t_2);
11928 __Pyx_XGOTREF(__pyx_t_3);
11929 __Pyx_XGOTREF(__pyx_t_4);
11939 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 493, __pyx_L3_error)
11940 __Pyx_GOTREF(__pyx_t_5);
11941 __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 493, __pyx_L3_error)
11942 __Pyx_GOTREF(__pyx_t_6);
11945 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
11946 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
11947 if (likely(__pyx_t_7)) {
11948 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_5);
11949 __Pyx_INCREF(__pyx_t_7);
11950 __Pyx_INCREF(
function);
11951 __Pyx_DECREF_SET(__pyx_t_5,
function);
11955 #if CYTHON_FAST_PYCALL
11956 if (PyFunction_Check(__pyx_t_5)) {
11957 PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
11958 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 493, __pyx_L3_error)
11959 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
11960 __Pyx_GOTREF(__pyx_t_1);
11961 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11964 #if CYTHON_FAST_PYCCALL
11965 if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
11966 PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
11967 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 493, __pyx_L3_error)
11968 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
11969 __Pyx_GOTREF(__pyx_t_1);
11970 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11974 __pyx_t_9 = PyTuple_New(2+__pyx_t_8);
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 493, __pyx_L3_error)
11975 __Pyx_GOTREF(__pyx_t_9);
11977 __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
11979 __Pyx_GIVEREF(__pyx_t_6);
11980 PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
11981 __Pyx_INCREF(__pyx_v_bytesitem);
11982 __Pyx_GIVEREF(__pyx_v_bytesitem);
11983 PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem);
11985 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 493, __pyx_L3_error)
11986 __Pyx_GOTREF(__pyx_t_1);
11987 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
11989 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11990 __pyx_v_result = __pyx_t_1;
12010 __pyx_t_10 = strlen(__pyx_v_self->view.format);
12011 __pyx_t_11 = ((__pyx_t_10 == 1) != 0);
12021 __Pyx_XDECREF(__pyx_r);
12022 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0,
long, 1, __Pyx_PyInt_From_long, 0, 0, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 498, __pyx_L5_except_error)
12023 __Pyx_GOTREF(__pyx_t_1);
12024 __pyx_r = __pyx_t_1;
12026 goto __pyx_L6_except_return;
12044 __Pyx_XDECREF(__pyx_r);
12045 __Pyx_INCREF(__pyx_v_result);
12046 __pyx_r = __pyx_v_result;
12047 goto __pyx_L6_except_return;
12050 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
12051 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
12052 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
12053 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
12054 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
12063 __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9);
12064 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 494, __pyx_L5_except_error)
12065 __Pyx_GOTREF(__pyx_t_6);
12066 __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6);
12067 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
12068 __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_9);
12069 __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_9 = 0;
12071 __Pyx_AddTraceback(
"View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
12072 if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(1, 494, __pyx_L5_except_error)
12073 __Pyx_GOTREF(__pyx_t_9);
12074 __Pyx_GOTREF(__pyx_t_5);
12075 __Pyx_GOTREF(__pyx_t_1);
12084 __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 495, __pyx_L5_except_error)
12085 __Pyx_GOTREF(__pyx_t_6);
12086 __Pyx_Raise(__pyx_t_6, 0, 0, 0);
12087 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
12088 __PYX_ERR(1, 495, __pyx_L5_except_error)
12090 goto __pyx_L5_except_error;
12091 __pyx_L5_except_error:;
12100 __Pyx_XGIVEREF(__pyx_t_2);
12101 __Pyx_XGIVEREF(__pyx_t_3);
12102 __Pyx_XGIVEREF(__pyx_t_4);
12103 __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
12104 goto __pyx_L1_error;
12105 __pyx_L6_except_return:;
12106 __Pyx_XGIVEREF(__pyx_t_2);
12107 __Pyx_XGIVEREF(__pyx_t_3);
12108 __Pyx_XGIVEREF(__pyx_t_4);
12109 __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
12123 __Pyx_XDECREF(__pyx_t_1);
12124 __Pyx_XDECREF(__pyx_t_5);
12125 __Pyx_XDECREF(__pyx_t_6);
12126 __Pyx_XDECREF(__pyx_t_7);
12127 __Pyx_XDECREF(__pyx_t_9);
12128 __Pyx_AddTraceback(
"View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
12131 __Pyx_XDECREF(__pyx_v_struct);
12132 __Pyx_XDECREF(__pyx_v_bytesitem);
12133 __Pyx_XDECREF(__pyx_v_result);
12134 __Pyx_XGIVEREF(__pyx_r);
12135 __Pyx_RefNannyFinishContext();
12147 static PyObject *__pyx_memoryview_assign_item_from_object(
struct __pyx_memoryview_obj *__pyx_v_self,
char *__pyx_v_itemp, PyObject *__pyx_v_value) {
12148 PyObject *__pyx_v_struct = NULL;
12150 PyObject *__pyx_v_bytesvalue = 0;
12151 Py_ssize_t __pyx_v_i;
12152 PyObject *__pyx_r = NULL;
12153 __Pyx_RefNannyDeclarations
12154 PyObject *__pyx_t_1 = NULL;
12157 PyObject *__pyx_t_4 = NULL;
12158 PyObject *__pyx_t_5 = NULL;
12159 PyObject *__pyx_t_6 = NULL;
12161 PyObject *__pyx_t_8 = NULL;
12162 Py_ssize_t __pyx_t_9;
12163 PyObject *__pyx_t_10 = NULL;
12168 int __pyx_lineno = 0;
12169 const char *__pyx_filename = NULL;
12170 int __pyx_clineno = 0;
12171 __Pyx_RefNannySetupContext(
"assign_item_from_object", 0);
12180 __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 504, __pyx_L1_error)
12181 __Pyx_GOTREF(__pyx_t_1);
12182 __pyx_v_struct = __pyx_t_1;
12192 __pyx_t_2 = PyTuple_Check(__pyx_v_value);
12193 __pyx_t_3 = (__pyx_t_2 != 0);
12203 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 510, __pyx_L1_error)
12204 __Pyx_GOTREF(__pyx_t_1);
12205 __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 510, __pyx_L1_error)
12206 __Pyx_GOTREF(__pyx_t_4);
12207 __pyx_t_5 = PyTuple_New(1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 510, __pyx_L1_error)
12208 __Pyx_GOTREF(__pyx_t_5);
12209 __Pyx_GIVEREF(__pyx_t_4);
12210 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
12212 __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 510, __pyx_L1_error)
12213 __Pyx_GOTREF(__pyx_t_4);
12214 __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 510, __pyx_L1_error)
12215 __Pyx_GOTREF(__pyx_t_6);
12216 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12217 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12218 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 510, __pyx_L1_error)
12219 __Pyx_GOTREF(__pyx_t_4);
12220 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12221 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
12222 if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError,
"Expected %.16s, got %.200s",
"bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(1, 510, __pyx_L1_error)
12223 __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
12244 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 512, __pyx_L1_error)
12245 __Pyx_GOTREF(__pyx_t_6);
12246 __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 512, __pyx_L1_error)
12247 __Pyx_GOTREF(__pyx_t_1);
12250 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
12251 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
12252 if (likely(__pyx_t_5)) {
12253 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_6);
12254 __Pyx_INCREF(__pyx_t_5);
12255 __Pyx_INCREF(
function);
12256 __Pyx_DECREF_SET(__pyx_t_6,
function);
12260 #if CYTHON_FAST_PYCALL
12261 if (PyFunction_Check(__pyx_t_6)) {
12262 PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
12263 __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 512, __pyx_L1_error)
12264 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
12265 __Pyx_GOTREF(__pyx_t_4);
12266 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12269 #if CYTHON_FAST_PYCCALL
12270 if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
12271 PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
12272 __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 512, __pyx_L1_error)
12273 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
12274 __Pyx_GOTREF(__pyx_t_4);
12275 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12279 __pyx_t_8 = PyTuple_New(2+__pyx_t_7);
if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 512, __pyx_L1_error)
12280 __Pyx_GOTREF(__pyx_t_8);
12282 __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
12284 __Pyx_GIVEREF(__pyx_t_1);
12285 PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1);
12286 __Pyx_INCREF(__pyx_v_value);
12287 __Pyx_GIVEREF(__pyx_v_value);
12288 PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value);
12290 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 512, __pyx_L1_error)
12291 __Pyx_GOTREF(__pyx_t_4);
12292 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
12294 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
12295 if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError,
"Expected %.16s, got %.200s",
"bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(1, 512, __pyx_L1_error)
12296 __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
12309 if (unlikely(__pyx_v_bytesvalue == Py_None)) {
12310 PyErr_SetString(PyExc_TypeError,
"'NoneType' is not iterable");
12311 __PYX_ERR(1, 514, __pyx_L1_error)
12313 __Pyx_INCREF(__pyx_v_bytesvalue);
12314 __pyx_t_10 = __pyx_v_bytesvalue;
12315 __pyx_t_12 = PyBytes_AS_STRING(__pyx_t_10);
12316 __pyx_t_13 = (__pyx_t_12 + PyBytes_GET_SIZE(__pyx_t_10));
12317 for (__pyx_t_14 = __pyx_t_12; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) {
12318 __pyx_t_11 = __pyx_t_14;
12319 __pyx_v_c = (__pyx_t_11[0]);
12328 __pyx_v_i = __pyx_t_9;
12337 __pyx_t_9 = (__pyx_t_9 + 1);
12346 (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
12348 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
12359 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
12362 __Pyx_XDECREF(__pyx_t_1);
12363 __Pyx_XDECREF(__pyx_t_4);
12364 __Pyx_XDECREF(__pyx_t_5);
12365 __Pyx_XDECREF(__pyx_t_6);
12366 __Pyx_XDECREF(__pyx_t_8);
12367 __Pyx_XDECREF(__pyx_t_10);
12368 __Pyx_AddTraceback(
"View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
12371 __Pyx_XDECREF(__pyx_v_struct);
12372 __Pyx_XDECREF(__pyx_v_bytesvalue);
12373 __Pyx_XGIVEREF(__pyx_r);
12374 __Pyx_RefNannyFinishContext();
12387 static CYTHON_UNUSED
int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
12388 static CYTHON_UNUSED
int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags) {
12390 __Pyx_RefNannyDeclarations
12391 __Pyx_RefNannySetupContext(
"__getbuffer__ (wrapper)", 0);
12392 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((
struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((
int)__pyx_v_flags));
12395 __Pyx_RefNannyFinishContext();
12399 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(
struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags) {
12401 __Pyx_RefNannyDeclarations
12404 PyObject *__pyx_t_3 = NULL;
12405 Py_ssize_t *__pyx_t_4;
12409 Py_ssize_t __pyx_t_8;
12410 int __pyx_lineno = 0;
12411 const char *__pyx_filename = NULL;
12412 int __pyx_clineno = 0;
12413 if (__pyx_v_info == NULL) {
12414 PyErr_SetString(PyExc_BufferError,
"PyObject_GetBuffer: view==NULL argument is obsolete");
12417 __Pyx_RefNannySetupContext(
"__getbuffer__", 0);
12418 __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
12419 __Pyx_GIVEREF(__pyx_v_info->obj);
12428 __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0);
12431 __pyx_t_1 = __pyx_t_2;
12432 goto __pyx_L4_bool_binop_done;
12434 __pyx_t_2 = (__pyx_v_self->view.readonly != 0);
12435 __pyx_t_1 = __pyx_t_2;
12436 __pyx_L4_bool_binop_done:;
12437 if (unlikely(__pyx_t_1)) {
12446 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__20, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 520, __pyx_L1_error)
12447 __Pyx_GOTREF(__pyx_t_3);
12448 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
12449 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12450 __PYX_ERR(1, 520, __pyx_L1_error)
12468 __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0);
12478 __pyx_t_4 = __pyx_v_self->view.shape;
12479 __pyx_v_info->shape = __pyx_t_4;
12499 __pyx_v_info->shape = NULL;
12510 __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
12520 __pyx_t_4 = __pyx_v_self->view.strides;
12521 __pyx_v_info->strides = __pyx_t_4;
12541 __pyx_v_info->strides = NULL;
12552 __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
12562 __pyx_t_4 = __pyx_v_self->view.suboffsets;
12563 __pyx_v_info->suboffsets = __pyx_t_4;
12583 __pyx_v_info->suboffsets = NULL;
12594 __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
12604 __pyx_t_5 = __pyx_v_self->view.format;
12605 __pyx_v_info->format = __pyx_t_5;
12625 __pyx_v_info->format = NULL;
12636 __pyx_t_6 = __pyx_v_self->view.buf;
12637 __pyx_v_info->buf = __pyx_t_6;
12646 __pyx_t_7 = __pyx_v_self->view.ndim;
12647 __pyx_v_info->ndim = __pyx_t_7;
12656 __pyx_t_8 = __pyx_v_self->view.itemsize;
12657 __pyx_v_info->itemsize = __pyx_t_8;
12666 __pyx_t_8 = __pyx_v_self->view.len;
12667 __pyx_v_info->len = __pyx_t_8;
12676 __pyx_t_1 = __pyx_v_self->view.readonly;
12677 __pyx_v_info->readonly = __pyx_t_1;
12686 __Pyx_INCREF(((PyObject *)__pyx_v_self));
12687 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
12688 __Pyx_GOTREF(__pyx_v_info->obj);
12689 __Pyx_DECREF(__pyx_v_info->obj);
12690 __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
12704 __Pyx_XDECREF(__pyx_t_3);
12705 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12707 if (__pyx_v_info->obj != NULL) {
12708 __Pyx_GOTREF(__pyx_v_info->obj);
12709 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
12713 if (__pyx_v_info->obj == Py_None) {
12714 __Pyx_GOTREF(__pyx_v_info->obj);
12715 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
12718 __Pyx_RefNannyFinishContext();
12731 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self);
12732 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) {
12733 PyObject *__pyx_r = 0;
12734 __Pyx_RefNannyDeclarations
12735 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
12736 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
12739 __Pyx_RefNannyFinishContext();
12743 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
12744 struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
12745 PyObject *__pyx_r = NULL;
12746 __Pyx_RefNannyDeclarations
12747 PyObject *__pyx_t_1 = NULL;
12749 int __pyx_lineno = 0;
12750 const char *__pyx_filename = NULL;
12751 int __pyx_clineno = 0;
12752 __Pyx_RefNannySetupContext(
"__get__", 0);
12761 __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 554, __pyx_L1_error)
12762 __Pyx_GOTREF(__pyx_t_1);
12763 if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(1, 554, __pyx_L1_error)
12764 __pyx_v_result = ((
struct __pyx_memoryviewslice_obj *)__pyx_t_1);
12774 __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice));
if (unlikely(__pyx_t_2 == ((
int)0))) __PYX_ERR(1, 555, __pyx_L1_error)
12783 __Pyx_XDECREF(__pyx_r);
12784 __Pyx_INCREF(((PyObject *)__pyx_v_result));
12785 __pyx_r = ((PyObject *)__pyx_v_result);
12798 __Pyx_XDECREF(__pyx_t_1);
12799 __Pyx_AddTraceback(
"View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12802 __Pyx_XDECREF((PyObject *)__pyx_v_result);
12803 __Pyx_XGIVEREF(__pyx_r);
12804 __Pyx_RefNannyFinishContext();
12817 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self);
12818 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) {
12819 PyObject *__pyx_r = 0;
12820 __Pyx_RefNannyDeclarations
12821 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
12822 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
12825 __Pyx_RefNannyFinishContext();
12829 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
12830 PyObject *__pyx_r = NULL;
12831 __Pyx_RefNannyDeclarations
12832 __Pyx_RefNannySetupContext(
"__get__", 0);
12841 __Pyx_XDECREF(__pyx_r);
12842 __Pyx_INCREF(__pyx_v_self->obj);
12843 __pyx_r = __pyx_v_self->obj;
12856 __Pyx_XGIVEREF(__pyx_r);
12857 __Pyx_RefNannyFinishContext();
12870 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self);
12871 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) {
12872 PyObject *__pyx_r = 0;
12873 __Pyx_RefNannyDeclarations
12874 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
12875 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
12878 __Pyx_RefNannyFinishContext();
12882 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
12883 Py_ssize_t __pyx_v_length;
12884 PyObject *__pyx_r = NULL;
12885 __Pyx_RefNannyDeclarations
12886 PyObject *__pyx_t_1 = NULL;
12887 Py_ssize_t *__pyx_t_2;
12888 Py_ssize_t *__pyx_t_3;
12889 Py_ssize_t *__pyx_t_4;
12890 PyObject *__pyx_t_5 = NULL;
12891 int __pyx_lineno = 0;
12892 const char *__pyx_filename = NULL;
12893 int __pyx_clineno = 0;
12894 __Pyx_RefNannySetupContext(
"__get__", 0);
12903 __Pyx_XDECREF(__pyx_r);
12904 __pyx_t_1 = PyList_New(0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 564, __pyx_L1_error)
12905 __Pyx_GOTREF(__pyx_t_1);
12906 __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
12907 for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
12908 __pyx_t_2 = __pyx_t_4;
12909 __pyx_v_length = (__pyx_t_2[0]);
12910 __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 564, __pyx_L1_error)
12911 __Pyx_GOTREF(__pyx_t_5);
12912 if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 564, __pyx_L1_error)
12913 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12915 __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1));
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 564, __pyx_L1_error)
12916 __Pyx_GOTREF(__pyx_t_5);
12917 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12918 __pyx_r = __pyx_t_5;
12932 __Pyx_XDECREF(__pyx_t_1);
12933 __Pyx_XDECREF(__pyx_t_5);
12934 __Pyx_AddTraceback(
"View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12937 __Pyx_XGIVEREF(__pyx_r);
12938 __Pyx_RefNannyFinishContext();
12951 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self);
12952 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) {
12953 PyObject *__pyx_r = 0;
12954 __Pyx_RefNannyDeclarations
12955 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
12956 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
12959 __Pyx_RefNannyFinishContext();
12963 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
12964 Py_ssize_t __pyx_v_stride;
12965 PyObject *__pyx_r = NULL;
12966 __Pyx_RefNannyDeclarations
12968 PyObject *__pyx_t_2 = NULL;
12969 Py_ssize_t *__pyx_t_3;
12970 Py_ssize_t *__pyx_t_4;
12971 Py_ssize_t *__pyx_t_5;
12972 PyObject *__pyx_t_6 = NULL;
12973 int __pyx_lineno = 0;
12974 const char *__pyx_filename = NULL;
12975 int __pyx_clineno = 0;
12976 __Pyx_RefNannySetupContext(
"__get__", 0);
12985 __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
12986 if (unlikely(__pyx_t_1)) {
12995 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__21, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 570, __pyx_L1_error)
12996 __Pyx_GOTREF(__pyx_t_2);
12997 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
12998 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12999 __PYX_ERR(1, 570, __pyx_L1_error)
13017 __Pyx_XDECREF(__pyx_r);
13018 __pyx_t_2 = PyList_New(0);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 572, __pyx_L1_error)
13019 __Pyx_GOTREF(__pyx_t_2);
13020 __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim);
13021 for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
13022 __pyx_t_3 = __pyx_t_5;
13023 __pyx_v_stride = (__pyx_t_3[0]);
13024 __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 572, __pyx_L1_error)
13025 __Pyx_GOTREF(__pyx_t_6);
13026 if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 572, __pyx_L1_error)
13027 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
13029 __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2));
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 572, __pyx_L1_error)
13030 __Pyx_GOTREF(__pyx_t_6);
13031 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13032 __pyx_r = __pyx_t_6;
13046 __Pyx_XDECREF(__pyx_t_2);
13047 __Pyx_XDECREF(__pyx_t_6);
13048 __Pyx_AddTraceback(
"View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13051 __Pyx_XGIVEREF(__pyx_r);
13052 __Pyx_RefNannyFinishContext();
13065 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self);
13066 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) {
13067 PyObject *__pyx_r = 0;
13068 __Pyx_RefNannyDeclarations
13069 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
13070 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
13073 __Pyx_RefNannyFinishContext();
13077 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
13078 Py_ssize_t __pyx_v_suboffset;
13079 PyObject *__pyx_r = NULL;
13080 __Pyx_RefNannyDeclarations
13082 PyObject *__pyx_t_2 = NULL;
13083 PyObject *__pyx_t_3 = NULL;
13084 Py_ssize_t *__pyx_t_4;
13085 Py_ssize_t *__pyx_t_5;
13086 Py_ssize_t *__pyx_t_6;
13087 int __pyx_lineno = 0;
13088 const char *__pyx_filename = NULL;
13089 int __pyx_clineno = 0;
13090 __Pyx_RefNannySetupContext(
"__get__", 0);
13099 __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
13109 __Pyx_XDECREF(__pyx_r);
13110 __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 577, __pyx_L1_error)
13111 __Pyx_GOTREF(__pyx_t_2);
13112 __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__22, __pyx_t_2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 577, __pyx_L1_error)
13113 __Pyx_GOTREF(__pyx_t_3);
13114 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13115 __pyx_r = __pyx_t_3;
13135 __Pyx_XDECREF(__pyx_r);
13136 __pyx_t_3 = PyList_New(0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 579, __pyx_L1_error)
13137 __Pyx_GOTREF(__pyx_t_3);
13138 __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim);
13139 for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) {
13140 __pyx_t_4 = __pyx_t_6;
13141 __pyx_v_suboffset = (__pyx_t_4[0]);
13142 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 579, __pyx_L1_error)
13143 __Pyx_GOTREF(__pyx_t_2);
13144 if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(1, 579, __pyx_L1_error)
13145 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13147 __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3));
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 579, __pyx_L1_error)
13148 __Pyx_GOTREF(__pyx_t_2);
13149 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13150 __pyx_r = __pyx_t_2;
13164 __Pyx_XDECREF(__pyx_t_2);
13165 __Pyx_XDECREF(__pyx_t_3);
13166 __Pyx_AddTraceback(
"View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13169 __Pyx_XGIVEREF(__pyx_r);
13170 __Pyx_RefNannyFinishContext();
13183 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self);
13184 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) {
13185 PyObject *__pyx_r = 0;
13186 __Pyx_RefNannyDeclarations
13187 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
13188 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
13191 __Pyx_RefNannyFinishContext();
13195 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
13196 PyObject *__pyx_r = NULL;
13197 __Pyx_RefNannyDeclarations
13198 PyObject *__pyx_t_1 = NULL;
13199 int __pyx_lineno = 0;
13200 const char *__pyx_filename = NULL;
13201 int __pyx_clineno = 0;
13202 __Pyx_RefNannySetupContext(
"__get__", 0);
13211 __Pyx_XDECREF(__pyx_r);
13212 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 583, __pyx_L1_error)
13213 __Pyx_GOTREF(__pyx_t_1);
13214 __pyx_r = __pyx_t_1;
13228 __Pyx_XDECREF(__pyx_t_1);
13229 __Pyx_AddTraceback(
"View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13232 __Pyx_XGIVEREF(__pyx_r);
13233 __Pyx_RefNannyFinishContext();
13246 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self);
13247 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) {
13248 PyObject *__pyx_r = 0;
13249 __Pyx_RefNannyDeclarations
13250 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
13251 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
13254 __Pyx_RefNannyFinishContext();
13258 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
13259 PyObject *__pyx_r = NULL;
13260 __Pyx_RefNannyDeclarations
13261 PyObject *__pyx_t_1 = NULL;
13262 int __pyx_lineno = 0;
13263 const char *__pyx_filename = NULL;
13264 int __pyx_clineno = 0;
13265 __Pyx_RefNannySetupContext(
"__get__", 0);
13274 __Pyx_XDECREF(__pyx_r);
13275 __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 587, __pyx_L1_error)
13276 __Pyx_GOTREF(__pyx_t_1);
13277 __pyx_r = __pyx_t_1;
13291 __Pyx_XDECREF(__pyx_t_1);
13292 __Pyx_AddTraceback(
"View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13295 __Pyx_XGIVEREF(__pyx_r);
13296 __Pyx_RefNannyFinishContext();
13309 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self);
13310 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) {
13311 PyObject *__pyx_r = 0;
13312 __Pyx_RefNannyDeclarations
13313 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
13314 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
13317 __Pyx_RefNannyFinishContext();
13321 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
13322 PyObject *__pyx_r = NULL;
13323 __Pyx_RefNannyDeclarations
13324 PyObject *__pyx_t_1 = NULL;
13325 PyObject *__pyx_t_2 = NULL;
13326 PyObject *__pyx_t_3 = NULL;
13327 int __pyx_lineno = 0;
13328 const char *__pyx_filename = NULL;
13329 int __pyx_clineno = 0;
13330 __Pyx_RefNannySetupContext(
"__get__", 0);
13339 __Pyx_XDECREF(__pyx_r);
13340 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 591, __pyx_L1_error)
13341 __Pyx_GOTREF(__pyx_t_1);
13342 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 591, __pyx_L1_error)
13343 __Pyx_GOTREF(__pyx_t_2);
13344 __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 591, __pyx_L1_error)
13345 __Pyx_GOTREF(__pyx_t_3);
13346 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13347 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13348 __pyx_r = __pyx_t_3;
13362 __Pyx_XDECREF(__pyx_t_1);
13363 __Pyx_XDECREF(__pyx_t_2);
13364 __Pyx_XDECREF(__pyx_t_3);
13365 __Pyx_AddTraceback(
"View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13368 __Pyx_XGIVEREF(__pyx_r);
13369 __Pyx_RefNannyFinishContext();
13382 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self);
13383 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) {
13384 PyObject *__pyx_r = 0;
13385 __Pyx_RefNannyDeclarations
13386 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
13387 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
13390 __Pyx_RefNannyFinishContext();
13394 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
13395 PyObject *__pyx_v_result = NULL;
13396 PyObject *__pyx_v_length = NULL;
13397 PyObject *__pyx_r = NULL;
13398 __Pyx_RefNannyDeclarations
13401 Py_ssize_t *__pyx_t_3;
13402 Py_ssize_t *__pyx_t_4;
13403 Py_ssize_t *__pyx_t_5;
13404 PyObject *__pyx_t_6 = NULL;
13405 int __pyx_lineno = 0;
13406 const char *__pyx_filename = NULL;
13407 int __pyx_clineno = 0;
13408 __Pyx_RefNannySetupContext(
"__get__", 0);
13417 __pyx_t_1 = (__pyx_v_self->_size == Py_None);
13418 __pyx_t_2 = (__pyx_t_1 != 0);
13428 __Pyx_INCREF(__pyx_int_1);
13429 __pyx_v_result = __pyx_int_1;
13438 __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
13439 for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
13440 __pyx_t_3 = __pyx_t_5;
13441 __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0]));
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 598, __pyx_L1_error)
13442 __Pyx_GOTREF(__pyx_t_6);
13443 __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6);
13453 __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 599, __pyx_L1_error)
13454 __Pyx_GOTREF(__pyx_t_6);
13455 __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6);
13466 __Pyx_INCREF(__pyx_v_result);
13467 __Pyx_GIVEREF(__pyx_v_result);
13468 __Pyx_GOTREF(__pyx_v_self->_size);
13469 __Pyx_DECREF(__pyx_v_self->_size);
13470 __pyx_v_self->_size = __pyx_v_result;
13488 __Pyx_XDECREF(__pyx_r);
13489 __Pyx_INCREF(__pyx_v_self->_size);
13490 __pyx_r = __pyx_v_self->_size;
13503 __Pyx_XDECREF(__pyx_t_6);
13504 __Pyx_AddTraceback(
"View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13507 __Pyx_XDECREF(__pyx_v_result);
13508 __Pyx_XDECREF(__pyx_v_length);
13509 __Pyx_XGIVEREF(__pyx_r);
13510 __Pyx_RefNannyFinishContext();
13523 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self);
13524 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) {
13525 Py_ssize_t __pyx_r;
13526 __Pyx_RefNannyDeclarations
13527 __Pyx_RefNannySetupContext(
"__len__ (wrapper)", 0);
13528 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
13531 __Pyx_RefNannyFinishContext();
13535 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(
struct __pyx_memoryview_obj *__pyx_v_self) {
13536 Py_ssize_t __pyx_r;
13537 __Pyx_RefNannyDeclarations
13539 __Pyx_RefNannySetupContext(
"__len__", 0);
13548 __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
13558 __pyx_r = (__pyx_v_self->view.shape[0]);
13590 __Pyx_RefNannyFinishContext();
13603 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self);
13604 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) {
13605 PyObject *__pyx_r = 0;
13606 __Pyx_RefNannyDeclarations
13607 __Pyx_RefNannySetupContext(
"__repr__ (wrapper)", 0);
13608 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
13611 __Pyx_RefNannyFinishContext();
13615 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(
struct __pyx_memoryview_obj *__pyx_v_self) {
13616 PyObject *__pyx_r = NULL;
13617 __Pyx_RefNannyDeclarations
13618 PyObject *__pyx_t_1 = NULL;
13619 PyObject *__pyx_t_2 = NULL;
13620 PyObject *__pyx_t_3 = NULL;
13621 int __pyx_lineno = 0;
13622 const char *__pyx_filename = NULL;
13623 int __pyx_clineno = 0;
13624 __Pyx_RefNannySetupContext(
"__repr__", 0);
13633 __Pyx_XDECREF(__pyx_r);
13634 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 612, __pyx_L1_error)
13635 __Pyx_GOTREF(__pyx_t_1);
13636 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 612, __pyx_L1_error)
13637 __Pyx_GOTREF(__pyx_t_2);
13638 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13639 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 612, __pyx_L1_error)
13640 __Pyx_GOTREF(__pyx_t_1);
13641 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13650 __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self));
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 613, __pyx_L1_error)
13651 __Pyx_GOTREF(__pyx_t_2);
13660 __pyx_t_3 = PyTuple_New(2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 612, __pyx_L1_error)
13661 __Pyx_GOTREF(__pyx_t_3);
13662 __Pyx_GIVEREF(__pyx_t_1);
13663 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
13664 __Pyx_GIVEREF(__pyx_t_2);
13665 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
13668 __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 612, __pyx_L1_error)
13669 __Pyx_GOTREF(__pyx_t_2);
13670 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13671 __pyx_r = __pyx_t_2;
13685 __Pyx_XDECREF(__pyx_t_1);
13686 __Pyx_XDECREF(__pyx_t_2);
13687 __Pyx_XDECREF(__pyx_t_3);
13688 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13691 __Pyx_XGIVEREF(__pyx_r);
13692 __Pyx_RefNannyFinishContext();
13705 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self);
13706 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) {
13707 PyObject *__pyx_r = 0;
13708 __Pyx_RefNannyDeclarations
13709 __Pyx_RefNannySetupContext(
"__str__ (wrapper)", 0);
13710 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
13713 __Pyx_RefNannyFinishContext();
13717 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(
struct __pyx_memoryview_obj *__pyx_v_self) {
13718 PyObject *__pyx_r = NULL;
13719 __Pyx_RefNannyDeclarations
13720 PyObject *__pyx_t_1 = NULL;
13721 PyObject *__pyx_t_2 = NULL;
13722 int __pyx_lineno = 0;
13723 const char *__pyx_filename = NULL;
13724 int __pyx_clineno = 0;
13725 __Pyx_RefNannySetupContext(
"__str__", 0);
13734 __Pyx_XDECREF(__pyx_r);
13735 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 616, __pyx_L1_error)
13736 __Pyx_GOTREF(__pyx_t_1);
13737 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 616, __pyx_L1_error)
13738 __Pyx_GOTREF(__pyx_t_2);
13739 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13740 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 616, __pyx_L1_error)
13741 __Pyx_GOTREF(__pyx_t_1);
13742 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13743 __pyx_t_2 = PyTuple_New(1);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 616, __pyx_L1_error)
13744 __Pyx_GOTREF(__pyx_t_2);
13745 __Pyx_GIVEREF(__pyx_t_1);
13746 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
13748 __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 616, __pyx_L1_error)
13749 __Pyx_GOTREF(__pyx_t_1);
13750 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13751 __pyx_r = __pyx_t_1;
13765 __Pyx_XDECREF(__pyx_t_1);
13766 __Pyx_XDECREF(__pyx_t_2);
13767 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13770 __Pyx_XGIVEREF(__pyx_r);
13771 __Pyx_RefNannyFinishContext();
13784 static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
13785 static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
13786 PyObject *__pyx_r = 0;
13787 __Pyx_RefNannyDeclarations
13788 __Pyx_RefNannySetupContext(
"is_c_contig (wrapper)", 0);
13789 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((
struct __pyx_memoryview_obj *)__pyx_v_self));
13792 __Pyx_RefNannyFinishContext();
13796 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(
struct __pyx_memoryview_obj *__pyx_v_self) {
13797 __Pyx_memviewslice *__pyx_v_mslice;
13798 __Pyx_memviewslice __pyx_v_tmp;
13799 PyObject *__pyx_r = NULL;
13800 __Pyx_RefNannyDeclarations
13801 __Pyx_memviewslice *__pyx_t_1;
13802 PyObject *__pyx_t_2 = NULL;
13803 int __pyx_lineno = 0;
13804 const char *__pyx_filename = NULL;
13805 int __pyx_clineno = 0;
13806 __Pyx_RefNannySetupContext(
"is_c_contig", 0);
13815 __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp));
if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 622, __pyx_L1_error)
13816 __pyx_v_mslice = __pyx_t_1;
13825 __Pyx_XDECREF(__pyx_r);
13826 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]),
'C', __pyx_v_self->view.ndim));
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 623, __pyx_L1_error)
13827 __Pyx_GOTREF(__pyx_t_2);
13828 __pyx_r = __pyx_t_2;
13842 __Pyx_XDECREF(__pyx_t_2);
13843 __Pyx_AddTraceback(
"View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
13846 __Pyx_XGIVEREF(__pyx_r);
13847 __Pyx_RefNannyFinishContext();
13860 static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
13861 static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
13862 PyObject *__pyx_r = 0;
13863 __Pyx_RefNannyDeclarations
13864 __Pyx_RefNannySetupContext(
"is_f_contig (wrapper)", 0);
13865 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((
struct __pyx_memoryview_obj *)__pyx_v_self));
13868 __Pyx_RefNannyFinishContext();
13872 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(
struct __pyx_memoryview_obj *__pyx_v_self) {
13873 __Pyx_memviewslice *__pyx_v_mslice;
13874 __Pyx_memviewslice __pyx_v_tmp;
13875 PyObject *__pyx_r = NULL;
13876 __Pyx_RefNannyDeclarations
13877 __Pyx_memviewslice *__pyx_t_1;
13878 PyObject *__pyx_t_2 = NULL;
13879 int __pyx_lineno = 0;
13880 const char *__pyx_filename = NULL;
13881 int __pyx_clineno = 0;
13882 __Pyx_RefNannySetupContext(
"is_f_contig", 0);
13891 __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp));
if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 628, __pyx_L1_error)
13892 __pyx_v_mslice = __pyx_t_1;
13901 __Pyx_XDECREF(__pyx_r);
13902 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]),
'F', __pyx_v_self->view.ndim));
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 629, __pyx_L1_error)
13903 __Pyx_GOTREF(__pyx_t_2);
13904 __pyx_r = __pyx_t_2;
13918 __Pyx_XDECREF(__pyx_t_2);
13919 __Pyx_AddTraceback(
"View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
13922 __Pyx_XGIVEREF(__pyx_r);
13923 __Pyx_RefNannyFinishContext();
13936 static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
13937 static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
13938 PyObject *__pyx_r = 0;
13939 __Pyx_RefNannyDeclarations
13940 __Pyx_RefNannySetupContext(
"copy (wrapper)", 0);
13941 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((
struct __pyx_memoryview_obj *)__pyx_v_self));
13944 __Pyx_RefNannyFinishContext();
13948 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(
struct __pyx_memoryview_obj *__pyx_v_self) {
13949 __Pyx_memviewslice __pyx_v_mslice;
13951 PyObject *__pyx_r = NULL;
13952 __Pyx_RefNannyDeclarations
13953 __Pyx_memviewslice __pyx_t_1;
13954 PyObject *__pyx_t_2 = NULL;
13955 int __pyx_lineno = 0;
13956 const char *__pyx_filename = NULL;
13957 int __pyx_clineno = 0;
13958 __Pyx_RefNannySetupContext(
"copy", 0);
13967 __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS));
13976 __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice));
13985 __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((
char *)
"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object);
if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 636, __pyx_L1_error)
13986 __pyx_v_mslice = __pyx_t_1;
13995 __Pyx_XDECREF(__pyx_r);
13996 __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice));
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 641, __pyx_L1_error)
13997 __Pyx_GOTREF(__pyx_t_2);
13998 __pyx_r = __pyx_t_2;
14012 __Pyx_XDECREF(__pyx_t_2);
14013 __Pyx_AddTraceback(
"View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
14016 __Pyx_XGIVEREF(__pyx_r);
14017 __Pyx_RefNannyFinishContext();
14030 static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
14031 static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
14032 PyObject *__pyx_r = 0;
14033 __Pyx_RefNannyDeclarations
14034 __Pyx_RefNannySetupContext(
"copy_fortran (wrapper)", 0);
14035 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((
struct __pyx_memoryview_obj *)__pyx_v_self));
14038 __Pyx_RefNannyFinishContext();
14042 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(
struct __pyx_memoryview_obj *__pyx_v_self) {
14043 __Pyx_memviewslice __pyx_v_src;
14044 __Pyx_memviewslice __pyx_v_dst;
14046 PyObject *__pyx_r = NULL;
14047 __Pyx_RefNannyDeclarations
14048 __Pyx_memviewslice __pyx_t_1;
14049 PyObject *__pyx_t_2 = NULL;
14050 int __pyx_lineno = 0;
14051 const char *__pyx_filename = NULL;
14052 int __pyx_clineno = 0;
14053 __Pyx_RefNannySetupContext(
"copy_fortran", 0);
14062 __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS));
14071 __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src));
14080 __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((
char *)
"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object);
if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 648, __pyx_L1_error)
14081 __pyx_v_dst = __pyx_t_1;
14090 __Pyx_XDECREF(__pyx_r);
14091 __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst));
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 653, __pyx_L1_error)
14092 __Pyx_GOTREF(__pyx_t_2);
14093 __pyx_r = __pyx_t_2;
14107 __Pyx_XDECREF(__pyx_t_2);
14108 __Pyx_AddTraceback(
"View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename);
14111 __Pyx_XGIVEREF(__pyx_r);
14112 __Pyx_RefNannyFinishContext();
14123 static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
14124 static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
14125 PyObject *__pyx_r = 0;
14126 __Pyx_RefNannyDeclarations
14127 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
14128 __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
14131 __Pyx_RefNannyFinishContext();
14135 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED
struct __pyx_memoryview_obj *__pyx_v_self) {
14136 PyObject *__pyx_r = NULL;
14137 __Pyx_RefNannyDeclarations
14138 PyObject *__pyx_t_1 = NULL;
14139 int __pyx_lineno = 0;
14140 const char *__pyx_filename = NULL;
14141 int __pyx_clineno = 0;
14142 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
14150 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__23, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
14151 __Pyx_GOTREF(__pyx_t_1);
14152 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
14153 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14154 __PYX_ERR(1, 2, __pyx_L1_error)
14164 __Pyx_XDECREF(__pyx_t_1);
14165 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14167 __Pyx_XGIVEREF(__pyx_r);
14168 __Pyx_RefNannyFinishContext();
14180 static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
14181 static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
14182 PyObject *__pyx_r = 0;
14183 __Pyx_RefNannyDeclarations
14184 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
14185 __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((
struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
14188 __Pyx_RefNannyFinishContext();
14192 static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
14193 PyObject *__pyx_r = NULL;
14194 __Pyx_RefNannyDeclarations
14195 PyObject *__pyx_t_1 = NULL;
14196 int __pyx_lineno = 0;
14197 const char *__pyx_filename = NULL;
14198 int __pyx_clineno = 0;
14199 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
14206 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__24, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
14207 __Pyx_GOTREF(__pyx_t_1);
14208 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
14209 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14210 __PYX_ERR(1, 4, __pyx_L1_error)
14221 __Pyx_XDECREF(__pyx_t_1);
14222 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14224 __Pyx_XGIVEREF(__pyx_r);
14225 __Pyx_RefNannyFinishContext();
14237 static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o,
int __pyx_v_flags,
int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) {
14238 struct __pyx_memoryview_obj *__pyx_v_result = 0;
14239 PyObject *__pyx_r = NULL;
14240 __Pyx_RefNannyDeclarations
14241 PyObject *__pyx_t_1 = NULL;
14242 PyObject *__pyx_t_2 = NULL;
14243 PyObject *__pyx_t_3 = NULL;
14244 int __pyx_lineno = 0;
14245 const char *__pyx_filename = NULL;
14246 int __pyx_clineno = 0;
14247 __Pyx_RefNannySetupContext(
"memoryview_cwrapper", 0);
14256 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 658, __pyx_L1_error)
14257 __Pyx_GOTREF(__pyx_t_1);
14258 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 658, __pyx_L1_error)
14259 __Pyx_GOTREF(__pyx_t_2);
14260 __pyx_t_3 = PyTuple_New(3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 658, __pyx_L1_error)
14261 __Pyx_GOTREF(__pyx_t_3);
14262 __Pyx_INCREF(__pyx_v_o);
14263 __Pyx_GIVEREF(__pyx_v_o);
14264 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o);
14265 __Pyx_GIVEREF(__pyx_t_1);
14266 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
14267 __Pyx_GIVEREF(__pyx_t_2);
14268 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
14271 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 658, __pyx_L1_error)
14272 __Pyx_GOTREF(__pyx_t_2);
14273 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14274 __pyx_v_result = ((
struct __pyx_memoryview_obj *)__pyx_t_2);
14284 __pyx_v_result->typeinfo = __pyx_v_typeinfo;
14293 __Pyx_XDECREF(__pyx_r);
14294 __Pyx_INCREF(((PyObject *)__pyx_v_result));
14295 __pyx_r = ((PyObject *)__pyx_v_result);
14308 __Pyx_XDECREF(__pyx_t_1);
14309 __Pyx_XDECREF(__pyx_t_2);
14310 __Pyx_XDECREF(__pyx_t_3);
14311 __Pyx_AddTraceback(
"View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
14314 __Pyx_XDECREF((PyObject *)__pyx_v_result);
14315 __Pyx_XGIVEREF(__pyx_r);
14316 __Pyx_RefNannyFinishContext();
14328 static CYTHON_INLINE
int __pyx_memoryview_check(PyObject *__pyx_v_o) {
14330 __Pyx_RefNannyDeclarations
14332 __Pyx_RefNannySetupContext(
"memoryview_check", 0);
14341 __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type);
14342 __pyx_r = __pyx_t_1;
14355 __Pyx_RefNannyFinishContext();
14367 static PyObject *_unellipsify(PyObject *__pyx_v_index,
int __pyx_v_ndim) {
14368 PyObject *__pyx_v_tup = NULL;
14369 PyObject *__pyx_v_result = NULL;
14370 int __pyx_v_have_slices;
14371 int __pyx_v_seen_ellipsis;
14372 CYTHON_UNUSED PyObject *__pyx_v_idx = NULL;
14373 PyObject *__pyx_v_item = NULL;
14374 Py_ssize_t __pyx_v_nslices;
14375 PyObject *__pyx_r = NULL;
14376 __Pyx_RefNannyDeclarations
14379 PyObject *__pyx_t_3 = NULL;
14380 PyObject *__pyx_t_4 = NULL;
14381 Py_ssize_t __pyx_t_5;
14382 PyObject *(*__pyx_t_6)(PyObject *);
14383 PyObject *__pyx_t_7 = NULL;
14384 Py_ssize_t __pyx_t_8;
14387 PyObject *__pyx_t_11 = NULL;
14388 int __pyx_lineno = 0;
14389 const char *__pyx_filename = NULL;
14390 int __pyx_clineno = 0;
14391 __Pyx_RefNannySetupContext(
"_unellipsify", 0);
14400 __pyx_t_1 = PyTuple_Check(__pyx_v_index);
14401 __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
14411 __pyx_t_3 = PyTuple_New(1);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 672, __pyx_L1_error)
14412 __Pyx_GOTREF(__pyx_t_3);
14413 __Pyx_INCREF(__pyx_v_index);
14414 __Pyx_GIVEREF(__pyx_v_index);
14415 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
14416 __pyx_v_tup = __pyx_t_3;
14437 __Pyx_INCREF(__pyx_v_index);
14438 __pyx_v_tup = __pyx_v_index;
14449 __pyx_t_3 = PyList_New(0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 676, __pyx_L1_error)
14450 __Pyx_GOTREF(__pyx_t_3);
14451 __pyx_v_result = ((PyObject*)__pyx_t_3);
14461 __pyx_v_have_slices = 0;
14470 __pyx_v_seen_ellipsis = 0;
14479 __Pyx_INCREF(__pyx_int_0);
14480 __pyx_t_3 = __pyx_int_0;
14481 if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) {
14482 __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
14485 __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 679, __pyx_L1_error)
14486 __Pyx_GOTREF(__pyx_t_4);
14487 __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext;
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 679, __pyx_L1_error)
14490 if (likely(!__pyx_t_6)) {
14491 if (likely(PyList_CheckExact(__pyx_t_4))) {
14492 if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4))
break;
14493 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14494 __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++;
if (unlikely(0 < 0)) __PYX_ERR(1, 679, __pyx_L1_error)
14496 __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++;
if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 679, __pyx_L1_error)
14497 __Pyx_GOTREF(__pyx_t_7);
14500 if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4))
break;
14501 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14502 __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++;
if (unlikely(0 < 0)) __PYX_ERR(1, 679, __pyx_L1_error)
14504 __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++;
if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 679, __pyx_L1_error)
14505 __Pyx_GOTREF(__pyx_t_7);
14509 __pyx_t_7 = __pyx_t_6(__pyx_t_4);
14510 if (unlikely(!__pyx_t_7)) {
14511 PyObject* exc_type = PyErr_Occurred();
14513 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
14514 else __PYX_ERR(1, 679, __pyx_L1_error)
14518 __Pyx_GOTREF(__pyx_t_7);
14520 __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
14522 __Pyx_INCREF(__pyx_t_3);
14523 __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
14524 __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0);
if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 679, __pyx_L1_error)
14525 __Pyx_GOTREF(__pyx_t_7);
14526 __Pyx_DECREF(__pyx_t_3);
14527 __pyx_t_3 = __pyx_t_7;
14537 __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
14538 __pyx_t_1 = (__pyx_t_2 != 0);
14548 __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
14558 __pyx_t_8 = PyObject_Length(__pyx_v_tup);
if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(1, 682, __pyx_L1_error)
14559 __pyx_t_7 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_8) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_8) + 1)));
if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 682, __pyx_L1_error)
14560 __Pyx_GOTREF(__pyx_t_7);
14561 { Py_ssize_t __pyx_temp;
14562 for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) {
14563 __Pyx_INCREF(__pyx_slice__25);
14564 __Pyx_GIVEREF(__pyx_slice__25);
14565 PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__25);
14568 __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7);
if (unlikely(__pyx_t_9 == ((
int)-1))) __PYX_ERR(1, 682, __pyx_L1_error)
14569 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
14578 __pyx_v_seen_ellipsis = 1;
14598 __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__25);
if (unlikely(__pyx_t_9 == ((
int)-1))) __PYX_ERR(1, 685, __pyx_L1_error)
14609 __pyx_v_have_slices = 1;
14629 __pyx_t_2 = PySlice_Check(__pyx_v_item);
14630 __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0);
14633 __pyx_t_1 = __pyx_t_10;
14634 goto __pyx_L9_bool_binop_done;
14636 __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0);
14637 __pyx_t_1 = __pyx_t_10;
14638 __pyx_L9_bool_binop_done:;
14639 if (unlikely(__pyx_t_1)) {
14648 __pyx_t_7 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Cannot_index_with_type_s, ((PyObject *)Py_TYPE(__pyx_v_item)));
if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 689, __pyx_L1_error)
14649 __Pyx_GOTREF(__pyx_t_7);
14650 __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7);
if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 689, __pyx_L1_error)
14651 __Pyx_GOTREF(__pyx_t_11);
14652 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
14653 __Pyx_Raise(__pyx_t_11, 0, 0, 0);
14654 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
14655 __PYX_ERR(1, 689, __pyx_L1_error)
14673 __pyx_t_10 = (__pyx_v_have_slices != 0);
14676 __pyx_t_1 = __pyx_t_10;
14677 goto __pyx_L11_bool_binop_done;
14679 __pyx_t_10 = PySlice_Check(__pyx_v_item);
14680 __pyx_t_2 = (__pyx_t_10 != 0);
14681 __pyx_t_1 = __pyx_t_2;
14682 __pyx_L11_bool_binop_done:;
14683 __pyx_v_have_slices = __pyx_t_1;
14692 __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item);
if (unlikely(__pyx_t_9 == ((
int)-1))) __PYX_ERR(1, 692, __pyx_L1_error)
14704 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14705 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14714 __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result);
if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 694, __pyx_L1_error)
14715 __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5);
14724 __pyx_t_1 = (__pyx_v_nslices != 0);
14734 __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices));
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 696, __pyx_L1_error)
14735 __Pyx_GOTREF(__pyx_t_3);
14736 { Py_ssize_t __pyx_temp;
14737 for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) {
14738 __Pyx_INCREF(__pyx_slice__25);
14739 __Pyx_GIVEREF(__pyx_slice__25);
14740 PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__25);
14743 __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3);
if (unlikely(__pyx_t_9 == ((
int)-1))) __PYX_ERR(1, 696, __pyx_L1_error)
14744 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14762 __Pyx_XDECREF(__pyx_r);
14763 if (!__pyx_v_have_slices) {
14765 __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 698, __pyx_L1_error)
14766 __Pyx_GOTREF(__pyx_t_4);
14767 __pyx_t_3 = __pyx_t_4;
14769 goto __pyx_L14_bool_binop_done;
14771 __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 698, __pyx_L1_error)
14772 __Pyx_GOTREF(__pyx_t_4);
14773 __pyx_t_3 = __pyx_t_4;
14775 __pyx_L14_bool_binop_done:;
14776 __pyx_t_4 = PyList_AsTuple(__pyx_v_result);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 698, __pyx_L1_error)
14777 __Pyx_GOTREF(__pyx_t_4);
14778 __pyx_t_11 = PyTuple_New(2);
if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 698, __pyx_L1_error)
14779 __Pyx_GOTREF(__pyx_t_11);
14780 __Pyx_GIVEREF(__pyx_t_3);
14781 PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
14782 __Pyx_GIVEREF(__pyx_t_4);
14783 PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4);
14786 __pyx_r = ((PyObject*)__pyx_t_11);
14800 __Pyx_XDECREF(__pyx_t_3);
14801 __Pyx_XDECREF(__pyx_t_4);
14802 __Pyx_XDECREF(__pyx_t_7);
14803 __Pyx_XDECREF(__pyx_t_11);
14804 __Pyx_AddTraceback(
"View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename);
14807 __Pyx_XDECREF(__pyx_v_tup);
14808 __Pyx_XDECREF(__pyx_v_result);
14809 __Pyx_XDECREF(__pyx_v_idx);
14810 __Pyx_XDECREF(__pyx_v_item);
14811 __Pyx_XGIVEREF(__pyx_r);
14812 __Pyx_RefNannyFinishContext();
14824 static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets,
int __pyx_v_ndim) {
14825 Py_ssize_t __pyx_v_suboffset;
14826 PyObject *__pyx_r = NULL;
14827 __Pyx_RefNannyDeclarations
14828 Py_ssize_t *__pyx_t_1;
14829 Py_ssize_t *__pyx_t_2;
14830 Py_ssize_t *__pyx_t_3;
14832 PyObject *__pyx_t_5 = NULL;
14833 int __pyx_lineno = 0;
14834 const char *__pyx_filename = NULL;
14835 int __pyx_clineno = 0;
14836 __Pyx_RefNannySetupContext(
"assert_direct_dimensions", 0);
14845 __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim);
14846 for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) {
14847 __pyx_t_1 = __pyx_t_3;
14848 __pyx_v_suboffset = (__pyx_t_1[0]);
14857 __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0);
14858 if (unlikely(__pyx_t_4)) {
14867 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__26, NULL);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 703, __pyx_L1_error)
14868 __Pyx_GOTREF(__pyx_t_5);
14869 __Pyx_Raise(__pyx_t_5, 0, 0, 0);
14870 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14871 __PYX_ERR(1, 703, __pyx_L1_error)
14892 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
14895 __Pyx_XDECREF(__pyx_t_5);
14896 __Pyx_AddTraceback(
"View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
14899 __Pyx_XGIVEREF(__pyx_r);
14900 __Pyx_RefNannyFinishContext();
14912 static struct __pyx_memoryview_obj *__pyx_memview_slice(
struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) {
14913 int __pyx_v_new_ndim;
14914 int __pyx_v_suboffset_dim;
14916 __Pyx_memviewslice __pyx_v_src;
14917 __Pyx_memviewslice __pyx_v_dst;
14918 __Pyx_memviewslice *__pyx_v_p_src;
14919 struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0;
14920 __Pyx_memviewslice *__pyx_v_p_dst;
14921 int *__pyx_v_p_suboffset_dim;
14922 Py_ssize_t __pyx_v_start;
14923 Py_ssize_t __pyx_v_stop;
14924 Py_ssize_t __pyx_v_step;
14925 int __pyx_v_have_start;
14926 int __pyx_v_have_stop;
14927 int __pyx_v_have_step;
14928 PyObject *__pyx_v_index = NULL;
14929 struct __pyx_memoryview_obj *__pyx_r = NULL;
14930 __Pyx_RefNannyDeclarations
14933 PyObject *__pyx_t_3 = NULL;
14934 struct __pyx_memoryview_obj *__pyx_t_4;
14937 Py_ssize_t __pyx_t_7;
14938 PyObject *(*__pyx_t_8)(PyObject *);
14939 PyObject *__pyx_t_9 = NULL;
14940 Py_ssize_t __pyx_t_10;
14942 Py_ssize_t __pyx_t_12;
14943 int __pyx_lineno = 0;
14944 const char *__pyx_filename = NULL;
14945 int __pyx_clineno = 0;
14946 __Pyx_RefNannySetupContext(
"memview_slice", 0);
14955 __pyx_v_new_ndim = 0;
14956 __pyx_v_suboffset_dim = -1;
14965 (void)(memset((&__pyx_v_dst), 0, (
sizeof(__pyx_v_dst))));
14974 #ifndef CYTHON_WITHOUT_ASSERTIONS
14975 if (unlikely(!Py_OptimizeFlag)) {
14976 if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
14977 PyErr_SetNone(PyExc_AssertionError);
14978 __PYX_ERR(1, 722, __pyx_L1_error)
14990 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
14991 __pyx_t_2 = (__pyx_t_1 != 0);
15001 if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 725, __pyx_L1_error)
15002 __pyx_t_3 = ((PyObject *)__pyx_v_memview);
15003 __Pyx_INCREF(__pyx_t_3);
15004 __pyx_v_memviewsliceobj = ((
struct __pyx_memoryviewslice_obj *)__pyx_t_3);
15014 __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice);
15034 __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src));
15043 __pyx_v_p_src = (&__pyx_v_src);
15054 __pyx_t_4 = __pyx_v_p_src->memview;
15055 __pyx_v_dst.memview = __pyx_t_4;
15064 __pyx_t_5 = __pyx_v_p_src->data;
15065 __pyx_v_dst.data = __pyx_t_5;
15074 __pyx_v_p_dst = (&__pyx_v_dst);
15083 __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim);
15093 if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
15094 __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
15097 __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 746, __pyx_L1_error)
15098 __Pyx_GOTREF(__pyx_t_3);
15099 __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext;
if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 746, __pyx_L1_error)
15102 if (likely(!__pyx_t_8)) {
15103 if (likely(PyList_CheckExact(__pyx_t_3))) {
15104 if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3))
break;
15105 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
15106 __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++;
if (unlikely(0 < 0)) __PYX_ERR(1, 746, __pyx_L1_error)
15108 __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++;
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 746, __pyx_L1_error)
15109 __Pyx_GOTREF(__pyx_t_9);
15112 if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3))
break;
15113 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
15114 __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++;
if (unlikely(0 < 0)) __PYX_ERR(1, 746, __pyx_L1_error)
15116 __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++;
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 746, __pyx_L1_error)
15117 __Pyx_GOTREF(__pyx_t_9);
15121 __pyx_t_9 = __pyx_t_8(__pyx_t_3);
15122 if (unlikely(!__pyx_t_9)) {
15123 PyObject* exc_type = PyErr_Occurred();
15125 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
15126 else __PYX_ERR(1, 746, __pyx_L1_error)
15130 __Pyx_GOTREF(__pyx_t_9);
15132 __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
15134 __pyx_v_dim = __pyx_t_6;
15135 __pyx_t_6 = (__pyx_t_6 + 1);
15144 __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0);
15154 __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index);
if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 751, __pyx_L1_error)
15163 __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0);
if (unlikely(__pyx_t_11 == ((
int)-1))) __PYX_ERR(1, 748, __pyx_L1_error)
15182 __pyx_t_2 = (__pyx_v_index == Py_None);
15183 __pyx_t_1 = (__pyx_t_2 != 0);
15193 (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1;
15202 (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0;
15211 (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1
L;
15220 __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
15240 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start);
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 760, __pyx_L1_error)
15241 __Pyx_GOTREF(__pyx_t_9);
15242 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 760, __pyx_L1_error)
15244 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
15246 __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9);
if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 760, __pyx_L1_error)
15247 __pyx_t_10 = __pyx_t_12;
15248 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
15249 goto __pyx_L7_bool_binop_done;
15252 __pyx_L7_bool_binop_done:;
15253 __pyx_v_start = __pyx_t_10;
15262 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop);
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 761, __pyx_L1_error)
15263 __Pyx_GOTREF(__pyx_t_9);
15264 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 761, __pyx_L1_error)
15266 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
15268 __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9);
if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 761, __pyx_L1_error)
15269 __pyx_t_10 = __pyx_t_12;
15270 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
15271 goto __pyx_L9_bool_binop_done;
15274 __pyx_L9_bool_binop_done:;
15275 __pyx_v_stop = __pyx_t_10;
15284 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step);
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 762, __pyx_L1_error)
15285 __Pyx_GOTREF(__pyx_t_9);
15286 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 762, __pyx_L1_error)
15288 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
15290 __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9);
if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 762, __pyx_L1_error)
15291 __pyx_t_10 = __pyx_t_12;
15292 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
15293 goto __pyx_L11_bool_binop_done;
15296 __pyx_L11_bool_binop_done:;
15297 __pyx_v_step = __pyx_t_10;
15306 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start);
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 764, __pyx_L1_error)
15307 __Pyx_GOTREF(__pyx_t_9);
15308 __pyx_t_1 = (__pyx_t_9 != Py_None);
15309 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
15310 __pyx_v_have_start = __pyx_t_1;
15319 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop);
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 765, __pyx_L1_error)
15320 __Pyx_GOTREF(__pyx_t_9);
15321 __pyx_t_1 = (__pyx_t_9 != Py_None);
15322 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
15323 __pyx_v_have_stop = __pyx_t_1;
15332 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step);
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 766, __pyx_L1_error)
15333 __Pyx_GOTREF(__pyx_t_9);
15334 __pyx_t_1 = (__pyx_t_9 != Py_None);
15335 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
15336 __pyx_v_have_step = __pyx_t_1;
15345 __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1);
if (unlikely(__pyx_t_11 == ((
int)-1))) __PYX_ERR(1, 768, __pyx_L1_error)
15354 __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
15366 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15375 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
15376 __pyx_t_2 = (__pyx_t_1 != 0);
15386 __Pyx_XDECREF(((PyObject *)__pyx_r));
15395 if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError(
"memviewsliceobj"); __PYX_ERR(1, 778, __pyx_L1_error) }
15404 if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError(
"memviewsliceobj"); __PYX_ERR(1, 779, __pyx_L1_error) }
15413 __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 777, __pyx_L1_error)
15414 __Pyx_GOTREF(__pyx_t_3);
15415 if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(1, 777, __pyx_L1_error)
15416 __pyx_r = ((
struct __pyx_memoryview_obj *)__pyx_t_3);
15437 __Pyx_XDECREF(((PyObject *)__pyx_r));
15446 __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 782, __pyx_L1_error)
15447 __Pyx_GOTREF(__pyx_t_3);
15456 if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(1, 782, __pyx_L1_error)
15457 __pyx_r = ((
struct __pyx_memoryview_obj *)__pyx_t_3);
15472 __Pyx_XDECREF(__pyx_t_3);
15473 __Pyx_XDECREF(__pyx_t_9);
15474 __Pyx_AddTraceback(
"View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
15477 __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj);
15478 __Pyx_XDECREF(__pyx_v_index);
15479 __Pyx_XGIVEREF((PyObject *)__pyx_r);
15480 __Pyx_RefNannyFinishContext();
15492 static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset,
int __pyx_v_dim,
int __pyx_v_new_ndim,
int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step,
int __pyx_v_have_start,
int __pyx_v_have_stop,
int __pyx_v_have_step,
int __pyx_v_is_slice) {
15493 Py_ssize_t __pyx_v_new_shape;
15494 int __pyx_v_negative_step;
15499 int __pyx_lineno = 0;
15500 const char *__pyx_filename = NULL;
15501 int __pyx_clineno = 0;
15510 __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
15520 __pyx_t_1 = ((__pyx_v_start < 0) != 0);
15530 __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
15548 __pyx_t_1 = (0 <= __pyx_v_start);
15550 __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
15552 __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
15562 __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((
char *)
"Index out of bounds (axis %d)"), __pyx_v_dim);
if (unlikely(__pyx_t_3 == ((
int)-1))) __PYX_ERR(1, 832, __pyx_L1_error)
15591 __pyx_t_1 = ((__pyx_v_have_step != 0) != 0);
15594 __pyx_t_2 = __pyx_t_1;
15595 goto __pyx_L6_bool_binop_done;
15597 __pyx_t_1 = ((__pyx_v_step < 0) != 0);
15598 __pyx_t_2 = __pyx_t_1;
15599 __pyx_L6_bool_binop_done:;
15600 __pyx_v_negative_step = __pyx_t_2;
15609 __pyx_t_1 = (__pyx_v_have_step != 0);
15612 __pyx_t_2 = __pyx_t_1;
15613 goto __pyx_L9_bool_binop_done;
15615 __pyx_t_1 = ((__pyx_v_step == 0) != 0);
15616 __pyx_t_2 = __pyx_t_1;
15617 __pyx_L9_bool_binop_done:;
15627 __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((
char *)
"Step may not be zero (axis %d)"), __pyx_v_dim);
if (unlikely(__pyx_t_3 == ((
int)-1))) __PYX_ERR(1, 838, __pyx_L1_error)
15645 __pyx_t_2 = (__pyx_v_have_start != 0);
15655 __pyx_t_2 = ((__pyx_v_start < 0) != 0);
15665 __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
15674 __pyx_t_2 = ((__pyx_v_start < 0) != 0);
15712 __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
15722 __pyx_t_2 = (__pyx_v_negative_step != 0);
15732 __pyx_v_start = (__pyx_v_shape - 1);
15752 __pyx_v_start = __pyx_v_shape;
15784 __pyx_t_2 = (__pyx_v_negative_step != 0);
15794 __pyx_v_start = (__pyx_v_shape - 1);
15827 __pyx_t_2 = (__pyx_v_have_stop != 0);
15837 __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
15847 __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape);
15856 __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
15894 __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
15904 __pyx_v_stop = __pyx_v_shape;
15934 __pyx_t_2 = (__pyx_v_negative_step != 0);
15944 __pyx_v_stop = -1
L;
15964 __pyx_v_stop = __pyx_v_shape;
15977 __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
16005 __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);
16014 __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
16024 __pyx_v_new_shape = (__pyx_v_new_shape + 1);
16042 __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
16052 __pyx_v_new_shape = 0;
16070 (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step);
16079 (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape;
16088 (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset;
16099 __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
16109 __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride));
16129 __pyx_t_3 = (__pyx_v_suboffset_dim[0]);
16130 (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride));
16141 __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
16151 __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
16161 __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
16171 __pyx_v_dst->data = ((((
char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset);
16199 __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((
char *)
"All dimensions preceding dimension %d must be indexed and not sliced"), __pyx_v_dim);
if (unlikely(__pyx_t_3 == ((
int)-1))) __PYX_ERR(1, 899, __pyx_L1_error)
16221 (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim;
16256 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
16258 __Pyx_AddTraceback(
"View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
16260 __Pyx_PyGILState_Release(__pyx_gilstate_save);
16276 static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view,
char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) {
16277 Py_ssize_t __pyx_v_shape;
16278 Py_ssize_t __pyx_v_stride;
16279 Py_ssize_t __pyx_v_suboffset;
16280 Py_ssize_t __pyx_v_itemsize;
16281 char *__pyx_v_resultp;
16283 __Pyx_RefNannyDeclarations
16284 Py_ssize_t __pyx_t_1;
16286 PyObject *__pyx_t_3 = NULL;
16287 PyObject *__pyx_t_4 = NULL;
16288 int __pyx_lineno = 0;
16289 const char *__pyx_filename = NULL;
16290 int __pyx_clineno = 0;
16291 __Pyx_RefNannySetupContext(
"pybuffer_index", 0);
16300 __pyx_v_suboffset = -1
L;
16309 __pyx_t_1 = __pyx_v_view->itemsize;
16310 __pyx_v_itemsize = __pyx_t_1;
16319 __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
16329 if (unlikely(__pyx_v_itemsize == 0)) {
16330 PyErr_SetString(PyExc_ZeroDivisionError,
"integer division or modulo by zero");
16331 __PYX_ERR(1, 917, __pyx_L1_error)
16333 else if (
sizeof(Py_ssize_t) ==
sizeof(
long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) {
16334 PyErr_SetString(PyExc_OverflowError,
"value too large to perform division");
16335 __PYX_ERR(1, 917, __pyx_L1_error)
16337 __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize);
16346 __pyx_v_stride = __pyx_v_itemsize;
16366 __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]);
16375 __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]);
16384 __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
16394 __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]);
16414 __pyx_t_2 = ((__pyx_v_index < 0) != 0);
16424 __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim]));
16433 __pyx_t_2 = ((__pyx_v_index < 0) != 0);
16434 if (unlikely(__pyx_t_2)) {
16443 __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 928, __pyx_L1_error)
16444 __Pyx_GOTREF(__pyx_t_3);
16445 __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 928, __pyx_L1_error)
16446 __Pyx_GOTREF(__pyx_t_4);
16447 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16448 __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 928, __pyx_L1_error)
16449 __Pyx_GOTREF(__pyx_t_3);
16450 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16451 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
16452 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16453 __PYX_ERR(1, 928, __pyx_L1_error)
16480 __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
16481 if (unlikely(__pyx_t_2)) {
16490 __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 931, __pyx_L1_error)
16491 __Pyx_GOTREF(__pyx_t_3);
16492 __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 931, __pyx_L1_error)
16493 __Pyx_GOTREF(__pyx_t_4);
16494 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16495 __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 931, __pyx_L1_error)
16496 __Pyx_GOTREF(__pyx_t_3);
16497 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16498 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
16499 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16500 __PYX_ERR(1, 931, __pyx_L1_error)
16518 __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride));
16527 __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
16537 __pyx_v_resultp = ((((
char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset);
16555 __pyx_r = __pyx_v_resultp;
16568 __Pyx_XDECREF(__pyx_t_3);
16569 __Pyx_XDECREF(__pyx_t_4);
16570 __Pyx_AddTraceback(
"View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
16573 __Pyx_RefNannyFinishContext();
16585 static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
16587 Py_ssize_t *__pyx_v_shape;
16588 Py_ssize_t *__pyx_v_strides;
16593 Py_ssize_t *__pyx_t_2;
16596 Py_ssize_t __pyx_t_5;
16597 Py_ssize_t __pyx_t_6;
16601 int __pyx_lineno = 0;
16602 const char *__pyx_filename = NULL;
16603 int __pyx_clineno = 0;
16612 __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
16613 __pyx_v_ndim = __pyx_t_1;
16622 __pyx_t_2 = __pyx_v_memslice->shape;
16623 __pyx_v_shape = __pyx_t_2;
16632 __pyx_t_2 = __pyx_v_memslice->strides;
16633 __pyx_v_strides = __pyx_t_2;
16642 __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2);
16643 __pyx_t_4 = __pyx_t_3;
16644 for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) {
16645 __pyx_v_i = __pyx_t_1;
16654 __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i);
16663 __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]);
16664 __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]);
16665 (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5;
16666 (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6;
16675 __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]);
16676 __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]);
16677 (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6;
16678 (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5;
16687 __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
16690 __pyx_t_7 = __pyx_t_8;
16691 goto __pyx_L6_bool_binop_done;
16693 __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
16694 __pyx_t_7 = __pyx_t_8;
16695 __pyx_L6_bool_binop_done:;
16705 __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, ((
char *)
"Cannot transpose memoryview with indirect dimensions"));
if (unlikely(__pyx_t_9 == ((
int)-1))) __PYX_ERR(1, 957, __pyx_L1_error)
16739 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
16741 __Pyx_AddTraceback(
"View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
16743 __Pyx_PyGILState_Release(__pyx_gilstate_save);
16760 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self);
16761 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) {
16762 __Pyx_RefNannyDeclarations
16763 __Pyx_RefNannySetupContext(
"__dealloc__ (wrapper)", 0);
16764 __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((
struct __pyx_memoryviewslice_obj *)__pyx_v_self));
16767 __Pyx_RefNannyFinishContext();
16770 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(
struct __pyx_memoryviewslice_obj *__pyx_v_self) {
16771 __Pyx_RefNannyDeclarations
16772 __Pyx_RefNannySetupContext(
"__dealloc__", 0);
16781 __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1);
16792 __Pyx_RefNannyFinishContext();
16803 static PyObject *__pyx_memoryviewslice_convert_item_to_object(
struct __pyx_memoryviewslice_obj *__pyx_v_self,
char *__pyx_v_itemp) {
16804 PyObject *__pyx_r = NULL;
16805 __Pyx_RefNannyDeclarations
16807 PyObject *__pyx_t_2 = NULL;
16808 int __pyx_lineno = 0;
16809 const char *__pyx_filename = NULL;
16810 int __pyx_clineno = 0;
16811 __Pyx_RefNannySetupContext(
"convert_item_to_object", 0);
16820 __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
16830 __Pyx_XDECREF(__pyx_r);
16831 __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 981, __pyx_L1_error)
16832 __Pyx_GOTREF(__pyx_t_2);
16833 __pyx_r = __pyx_t_2;
16854 __Pyx_XDECREF(__pyx_r);
16855 __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((
struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 983, __pyx_L1_error)
16856 __Pyx_GOTREF(__pyx_t_2);
16857 __pyx_r = __pyx_t_2;
16872 __Pyx_XDECREF(__pyx_t_2);
16873 __Pyx_AddTraceback(
"View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
16876 __Pyx_XGIVEREF(__pyx_r);
16877 __Pyx_RefNannyFinishContext();
16889 static PyObject *__pyx_memoryviewslice_assign_item_from_object(
struct __pyx_memoryviewslice_obj *__pyx_v_self,
char *__pyx_v_itemp, PyObject *__pyx_v_value) {
16890 PyObject *__pyx_r = NULL;
16891 __Pyx_RefNannyDeclarations
16894 PyObject *__pyx_t_3 = NULL;
16895 int __pyx_lineno = 0;
16896 const char *__pyx_filename = NULL;
16897 int __pyx_clineno = 0;
16898 __Pyx_RefNannySetupContext(
"assign_item_from_object", 0);
16907 __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
16917 __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value);
if (unlikely(__pyx_t_2 == ((
int)0))) __PYX_ERR(1, 987, __pyx_L1_error)
16937 __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((
struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 989, __pyx_L1_error)
16938 __Pyx_GOTREF(__pyx_t_3);
16939 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16952 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16955 __Pyx_XDECREF(__pyx_t_3);
16956 __Pyx_AddTraceback(
"View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
16959 __Pyx_XGIVEREF(__pyx_r);
16960 __Pyx_RefNannyFinishContext();
16973 static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self);
16974 static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self) {
16975 PyObject *__pyx_r = 0;
16976 __Pyx_RefNannyDeclarations
16977 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
16978 __pyx_r = __pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(((
struct __pyx_memoryviewslice_obj *)__pyx_v_self));
16981 __Pyx_RefNannyFinishContext();
16985 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(
struct __pyx_memoryviewslice_obj *__pyx_v_self) {
16986 PyObject *__pyx_r = NULL;
16987 __Pyx_RefNannyDeclarations
16988 __Pyx_RefNannySetupContext(
"__get__", 0);
16997 __Pyx_XDECREF(__pyx_r);
16998 __Pyx_INCREF(__pyx_v_self->from_object);
16999 __pyx_r = __pyx_v_self->from_object;
17012 __Pyx_XGIVEREF(__pyx_r);
17013 __Pyx_RefNannyFinishContext();
17024 static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
17025 static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
17026 PyObject *__pyx_r = 0;
17027 __Pyx_RefNannyDeclarations
17028 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
17029 __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((
struct __pyx_memoryviewslice_obj *)__pyx_v_self));
17032 __Pyx_RefNannyFinishContext();
17036 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED
struct __pyx_memoryviewslice_obj *__pyx_v_self) {
17037 PyObject *__pyx_r = NULL;
17038 __Pyx_RefNannyDeclarations
17039 PyObject *__pyx_t_1 = NULL;
17040 int __pyx_lineno = 0;
17041 const char *__pyx_filename = NULL;
17042 int __pyx_clineno = 0;
17043 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
17051 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__27, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
17052 __Pyx_GOTREF(__pyx_t_1);
17053 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
17054 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17055 __PYX_ERR(1, 2, __pyx_L1_error)
17065 __Pyx_XDECREF(__pyx_t_1);
17066 __Pyx_AddTraceback(
"View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
17068 __Pyx_XGIVEREF(__pyx_r);
17069 __Pyx_RefNannyFinishContext();
17081 static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
17082 static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
17083 PyObject *__pyx_r = 0;
17084 __Pyx_RefNannyDeclarations
17085 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
17086 __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((
struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
17089 __Pyx_RefNannyFinishContext();
17093 static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
17094 PyObject *__pyx_r = NULL;
17095 __Pyx_RefNannyDeclarations
17096 PyObject *__pyx_t_1 = NULL;
17097 int __pyx_lineno = 0;
17098 const char *__pyx_filename = NULL;
17099 int __pyx_clineno = 0;
17100 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
17107 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__28, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
17108 __Pyx_GOTREF(__pyx_t_1);
17109 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
17110 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17111 __PYX_ERR(1, 4, __pyx_L1_error)
17122 __Pyx_XDECREF(__pyx_t_1);
17123 __Pyx_AddTraceback(
"View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
17125 __Pyx_XGIVEREF(__pyx_r);
17126 __Pyx_RefNannyFinishContext();
17138 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice,
int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(
char *),
int (*__pyx_v_to_dtype_func)(
char *, PyObject *),
int __pyx_v_dtype_is_object) {
17139 struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
17140 Py_ssize_t __pyx_v_suboffset;
17141 PyObject *__pyx_v_length = NULL;
17142 PyObject *__pyx_r = NULL;
17143 __Pyx_RefNannyDeclarations
17145 PyObject *__pyx_t_2 = NULL;
17146 PyObject *__pyx_t_3 = NULL;
17147 __Pyx_TypeInfo *__pyx_t_4;
17148 Py_buffer __pyx_t_5;
17149 Py_ssize_t *__pyx_t_6;
17150 Py_ssize_t *__pyx_t_7;
17151 Py_ssize_t *__pyx_t_8;
17152 Py_ssize_t __pyx_t_9;
17153 int __pyx_lineno = 0;
17154 const char *__pyx_filename = NULL;
17155 int __pyx_clineno = 0;
17156 __Pyx_RefNannySetupContext(
"memoryview_fromslice", 0);
17165 __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
17175 __Pyx_XDECREF(__pyx_r);
17176 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
17195 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1013, __pyx_L1_error)
17196 __Pyx_GOTREF(__pyx_t_2);
17197 __pyx_t_3 = PyTuple_New(3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1013, __pyx_L1_error)
17198 __Pyx_GOTREF(__pyx_t_3);
17199 __Pyx_INCREF(Py_None);
17200 __Pyx_GIVEREF(Py_None);
17201 PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
17202 __Pyx_INCREF(__pyx_int_0);
17203 __Pyx_GIVEREF(__pyx_int_0);
17204 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
17205 __Pyx_GIVEREF(__pyx_t_2);
17206 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
17208 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1013, __pyx_L1_error)
17209 __Pyx_GOTREF(__pyx_t_2);
17210 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17211 __pyx_v_result = ((
struct __pyx_memoryviewslice_obj *)__pyx_t_2);
17221 __pyx_v_result->from_slice = __pyx_v_memviewslice;
17230 __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1);
17239 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1018, __pyx_L1_error)
17240 __Pyx_GOTREF(__pyx_t_2);
17241 __Pyx_GIVEREF(__pyx_t_2);
17242 __Pyx_GOTREF(__pyx_v_result->from_object);
17243 __Pyx_DECREF(__pyx_v_result->from_object);
17244 __pyx_v_result->from_object = __pyx_t_2;
17254 __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
17255 __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;
17264 __pyx_t_5 = __pyx_v_memviewslice.memview->view;
17265 __pyx_v_result->__pyx_base.view = __pyx_t_5;
17274 __pyx_v_result->__pyx_base.view.buf = ((
void *)__pyx_v_memviewslice.data);
17283 __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim;
17292 ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None;
17301 Py_INCREF(Py_None);
17310 __pyx_t_1 = ((((
struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0);
17320 __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS;
17340 __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO;
17351 __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape);
17360 __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides);
17369 __pyx_v_result->__pyx_base.view.suboffsets = NULL;
17378 __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim);
17379 for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
17380 __pyx_t_6 = __pyx_t_8;
17381 __pyx_v_suboffset = (__pyx_t_6[0]);
17390 __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0);
17400 __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets);
17409 goto __pyx_L6_break;
17429 __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize;
17430 __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
17439 __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim);
17440 for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
17441 __pyx_t_6 = __pyx_t_8;
17442 __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0]));
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1043, __pyx_L1_error)
17443 __Pyx_GOTREF(__pyx_t_2);
17444 __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2);
17454 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1044, __pyx_L1_error)
17455 __Pyx_GOTREF(__pyx_t_2);
17456 __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1044, __pyx_L1_error)
17457 __Pyx_GOTREF(__pyx_t_3);
17458 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17459 __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3);
if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 1044, __pyx_L1_error)
17460 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17461 __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
17471 __pyx_v_result->to_object_func = __pyx_v_to_object_func;
17480 __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func;
17489 __Pyx_XDECREF(__pyx_r);
17490 __Pyx_INCREF(((PyObject *)__pyx_v_result));
17491 __pyx_r = ((PyObject *)__pyx_v_result);
17504 __Pyx_XDECREF(__pyx_t_2);
17505 __Pyx_XDECREF(__pyx_t_3);
17506 __Pyx_AddTraceback(
"View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
17509 __Pyx_XDECREF((PyObject *)__pyx_v_result);
17510 __Pyx_XDECREF(__pyx_v_length);
17511 __Pyx_XGIVEREF(__pyx_r);
17512 __Pyx_RefNannyFinishContext();
17524 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(
struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) {
17525 struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
17526 __Pyx_memviewslice *__pyx_r;
17527 __Pyx_RefNannyDeclarations
17530 PyObject *__pyx_t_3 = NULL;
17531 int __pyx_lineno = 0;
17532 const char *__pyx_filename = NULL;
17533 int __pyx_clineno = 0;
17534 __Pyx_RefNannySetupContext(
"get_slice_from_memview", 0);
17543 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
17544 __pyx_t_2 = (__pyx_t_1 != 0);
17554 if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 1056, __pyx_L1_error)
17555 __pyx_t_3 = ((PyObject *)__pyx_v_memview);
17556 __Pyx_INCREF(__pyx_t_3);
17557 __pyx_v_obj = ((
struct __pyx_memoryviewslice_obj *)__pyx_t_3);
17567 __pyx_r = (&__pyx_v_obj->from_slice);
17587 __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice);
17596 __pyx_r = __pyx_v_mslice;
17610 __Pyx_XDECREF(__pyx_t_3);
17611 __Pyx_AddTraceback(
"View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
17614 __Pyx_XDECREF((PyObject *)__pyx_v_obj);
17615 __Pyx_RefNannyFinishContext();
17627 static void __pyx_memoryview_slice_copy(
struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) {
17629 Py_ssize_t *__pyx_v_shape;
17630 Py_ssize_t *__pyx_v_strides;
17631 Py_ssize_t *__pyx_v_suboffsets;
17632 __Pyx_RefNannyDeclarations
17633 Py_ssize_t *__pyx_t_1;
17637 Py_ssize_t __pyx_t_5;
17638 __Pyx_RefNannySetupContext(
"slice_copy", 0);
17647 __pyx_t_1 = __pyx_v_memview->view.shape;
17648 __pyx_v_shape = __pyx_t_1;
17657 __pyx_t_1 = __pyx_v_memview->view.strides;
17658 __pyx_v_strides = __pyx_t_1;
17667 __pyx_t_1 = __pyx_v_memview->view.suboffsets;
17668 __pyx_v_suboffsets = __pyx_t_1;
17677 __pyx_v_dst->memview = ((
struct __pyx_memoryview_obj *)__pyx_v_memview);
17686 __pyx_v_dst->data = ((
char *)__pyx_v_memview->view.buf);
17695 __pyx_t_2 = __pyx_v_memview->view.ndim;
17696 __pyx_t_3 = __pyx_t_2;
17697 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17698 __pyx_v_dim = __pyx_t_4;
17707 (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]);
17716 (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]);
17725 if ((__pyx_v_suboffsets != 0)) {
17726 __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]);
17730 (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5;
17742 __Pyx_RefNannyFinishContext();
17753 static PyObject *__pyx_memoryview_copy_object(
struct __pyx_memoryview_obj *__pyx_v_memview) {
17754 __Pyx_memviewslice __pyx_v_memviewslice;
17755 PyObject *__pyx_r = NULL;
17756 __Pyx_RefNannyDeclarations
17757 PyObject *__pyx_t_1 = NULL;
17758 int __pyx_lineno = 0;
17759 const char *__pyx_filename = NULL;
17760 int __pyx_clineno = 0;
17761 __Pyx_RefNannySetupContext(
"memoryview_copy", 0);
17770 __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice));
17779 __Pyx_XDECREF(__pyx_r);
17780 __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice));
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1084, __pyx_L1_error)
17781 __Pyx_GOTREF(__pyx_t_1);
17782 __pyx_r = __pyx_t_1;
17796 __Pyx_XDECREF(__pyx_t_1);
17797 __Pyx_AddTraceback(
"View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
17800 __Pyx_XGIVEREF(__pyx_r);
17801 __Pyx_RefNannyFinishContext();
17813 static PyObject *__pyx_memoryview_copy_object_from_slice(
struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) {
17814 PyObject *(*__pyx_v_to_object_func)(
char *);
17815 int (*__pyx_v_to_dtype_func)(
char *, PyObject *);
17816 PyObject *__pyx_r = NULL;
17817 __Pyx_RefNannyDeclarations
17820 PyObject *(*__pyx_t_3)(
char *);
17821 int (*__pyx_t_4)(
char *, PyObject *);
17822 PyObject *__pyx_t_5 = NULL;
17823 int __pyx_lineno = 0;
17824 const char *__pyx_filename = NULL;
17825 int __pyx_clineno = 0;
17826 __Pyx_RefNannySetupContext(
"memoryview_copy_from_slice", 0);
17835 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
17836 __pyx_t_2 = (__pyx_t_1 != 0);
17846 __pyx_t_3 = ((
struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
17847 __pyx_v_to_object_func = __pyx_t_3;
17856 __pyx_t_4 = ((
struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
17857 __pyx_v_to_dtype_func = __pyx_t_4;
17877 __pyx_v_to_object_func = NULL;
17886 __pyx_v_to_dtype_func = NULL;
17897 __Pyx_XDECREF(__pyx_r);
17906 __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1101, __pyx_L1_error)
17907 __Pyx_GOTREF(__pyx_t_5);
17908 __pyx_r = __pyx_t_5;
17922 __Pyx_XDECREF(__pyx_t_5);
17923 __Pyx_AddTraceback(
"View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
17926 __Pyx_XGIVEREF(__pyx_r);
17927 __Pyx_RefNannyFinishContext();
17939 static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
17940 Py_ssize_t __pyx_r;
17950 __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
17960 __pyx_r = (-__pyx_v_arg);
17980 __pyx_r = __pyx_v_arg;
18005 static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice,
int __pyx_v_ndim) {
18007 Py_ssize_t __pyx_v_c_stride;
18008 Py_ssize_t __pyx_v_f_stride;
18022 __pyx_v_c_stride = 0;
18031 __pyx_v_f_stride = 0;
18040 for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
18041 __pyx_v_i = __pyx_t_1;
18050 __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
18060 __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
18069 goto __pyx_L4_break;
18089 __pyx_t_1 = __pyx_v_ndim;
18090 __pyx_t_3 = __pyx_t_1;
18091 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
18092 __pyx_v_i = __pyx_t_4;
18101 __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
18111 __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
18120 goto __pyx_L7_break;
18140 __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
18195 static void _copy_strided_to_strided(
char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides,
char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape,
int __pyx_v_ndim,
size_t __pyx_v_itemsize) {
18196 CYTHON_UNUSED Py_ssize_t __pyx_v_i;
18197 CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent;
18198 Py_ssize_t __pyx_v_dst_extent;
18199 Py_ssize_t __pyx_v_src_stride;
18200 Py_ssize_t __pyx_v_dst_stride;
18204 Py_ssize_t __pyx_t_4;
18205 Py_ssize_t __pyx_t_5;
18206 Py_ssize_t __pyx_t_6;
18215 __pyx_v_src_extent = (__pyx_v_src_shape[0]);
18224 __pyx_v_dst_extent = (__pyx_v_dst_shape[0]);
18233 __pyx_v_src_stride = (__pyx_v_src_strides[0]);
18242 __pyx_v_dst_stride = (__pyx_v_dst_strides[0]);
18251 __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
18261 __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0);
18264 __pyx_t_1 = __pyx_t_2;
18265 goto __pyx_L5_bool_binop_done;
18267 __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
18270 __pyx_t_1 = __pyx_t_2;
18271 goto __pyx_L5_bool_binop_done;
18281 __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize);
18283 __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
18285 __pyx_t_3 = (__pyx_t_2 != 0);
18286 __pyx_t_1 = __pyx_t_3;
18287 __pyx_L5_bool_binop_done:;
18305 (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent)));
18325 __pyx_t_4 = __pyx_v_dst_extent;
18326 __pyx_t_5 = __pyx_t_4;
18327 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
18328 __pyx_v_i = __pyx_t_6;
18337 (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize));
18346 __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
18355 __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
18378 __pyx_t_4 = __pyx_v_dst_extent;
18379 __pyx_t_5 = __pyx_t_4;
18380 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
18381 __pyx_v_i = __pyx_t_6;
18390 _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize);
18399 __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
18408 __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
18432 static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst,
int __pyx_v_ndim,
size_t __pyx_v_itemsize) {
18441 _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize);
18462 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src,
int __pyx_v_ndim) {
18463 Py_ssize_t __pyx_v_shape;
18464 Py_ssize_t __pyx_v_size;
18465 Py_ssize_t __pyx_r;
18466 Py_ssize_t __pyx_t_1;
18467 Py_ssize_t *__pyx_t_2;
18468 Py_ssize_t *__pyx_t_3;
18469 Py_ssize_t *__pyx_t_4;
18478 __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
18479 __pyx_v_size = __pyx_t_1;
18488 __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim);
18489 for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
18490 __pyx_t_2 = __pyx_t_4;
18491 __pyx_v_shape = (__pyx_t_2[0]);
18500 __pyx_v_size = (__pyx_v_size * __pyx_v_shape);
18510 __pyx_r = __pyx_v_size;
18534 static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride,
int __pyx_v_ndim,
char __pyx_v_order) {
18536 Py_ssize_t __pyx_r;
18549 __pyx_t_1 = ((__pyx_v_order ==
'F') != 0);
18559 __pyx_t_2 = __pyx_v_ndim;
18560 __pyx_t_3 = __pyx_t_2;
18561 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
18562 __pyx_v_idx = __pyx_t_4;
18571 (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
18580 __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
18601 for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) {
18602 __pyx_v_idx = __pyx_t_2;
18611 (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
18620 __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
18632 __pyx_r = __pyx_v_stride;
18656 static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice,
char __pyx_v_order,
int __pyx_v_ndim) {
18658 void *__pyx_v_result;
18659 size_t __pyx_v_itemsize;
18660 size_t __pyx_v_size;
18662 Py_ssize_t __pyx_t_1;
18665 struct __pyx_memoryview_obj *__pyx_t_4;
18668 int __pyx_lineno = 0;
18669 const char *__pyx_filename = NULL;
18670 int __pyx_clineno = 0;
18679 __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
18680 __pyx_v_itemsize = __pyx_t_1;
18689 __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim);
18698 __pyx_v_result = malloc(__pyx_v_size);
18707 __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
18717 __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL);
if (unlikely(__pyx_t_3 == ((
int)-1))) __PYX_ERR(1, 1224, __pyx_L1_error)
18735 __pyx_v_tmpslice->data = ((
char *)__pyx_v_result);
18744 __pyx_t_4 = __pyx_v_src->memview;
18745 __pyx_v_tmpslice->memview = __pyx_t_4;
18754 __pyx_t_3 = __pyx_v_ndim;
18755 __pyx_t_5 = __pyx_t_3;
18756 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
18757 __pyx_v_i = __pyx_t_6;
18766 (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]);
18775 (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1
L;
18785 (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order));
18794 __pyx_t_3 = __pyx_v_ndim;
18795 __pyx_t_5 = __pyx_t_3;
18796 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
18797 __pyx_v_i = __pyx_t_6;
18806 __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
18816 (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0;
18835 __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0);
18845 (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size));
18865 copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize);
18876 __pyx_r = __pyx_v_result;
18891 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
18893 __Pyx_AddTraceback(
"View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename);
18895 __Pyx_PyGILState_Release(__pyx_gilstate_save);
18911 static int __pyx_memoryview_err_extents(
int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) {
18913 __Pyx_RefNannyDeclarations
18914 PyObject *__pyx_t_1 = NULL;
18915 PyObject *__pyx_t_2 = NULL;
18916 PyObject *__pyx_t_3 = NULL;
18917 PyObject *__pyx_t_4 = NULL;
18918 int __pyx_lineno = 0;
18919 const char *__pyx_filename = NULL;
18920 int __pyx_clineno = 0;
18922 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
18924 __Pyx_RefNannySetupContext(
"_err_extents", 0);
18933 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1254, __pyx_L1_error)
18934 __Pyx_GOTREF(__pyx_t_1);
18935 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1254, __pyx_L1_error)
18936 __Pyx_GOTREF(__pyx_t_2);
18937 __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1254, __pyx_L1_error)
18938 __Pyx_GOTREF(__pyx_t_3);
18939 __pyx_t_4 = PyTuple_New(3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1254, __pyx_L1_error)
18940 __Pyx_GOTREF(__pyx_t_4);
18941 __Pyx_GIVEREF(__pyx_t_1);
18942 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
18943 __Pyx_GIVEREF(__pyx_t_2);
18944 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
18945 __Pyx_GIVEREF(__pyx_t_3);
18946 PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
18958 __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1253, __pyx_L1_error)
18959 __Pyx_GOTREF(__pyx_t_3);
18960 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18961 __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1253, __pyx_L1_error)
18962 __Pyx_GOTREF(__pyx_t_4);
18963 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18964 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
18965 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18966 __PYX_ERR(1, 1253, __pyx_L1_error)
18978 __Pyx_XDECREF(__pyx_t_1);
18979 __Pyx_XDECREF(__pyx_t_2);
18980 __Pyx_XDECREF(__pyx_t_3);
18981 __Pyx_XDECREF(__pyx_t_4);
18982 __Pyx_AddTraceback(
"View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename);
18984 __Pyx_RefNannyFinishContext();
18986 __Pyx_PyGILState_Release(__pyx_gilstate_save);
18999 static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error,
char *__pyx_v_msg,
int __pyx_v_dim) {
19001 __Pyx_RefNannyDeclarations
19002 PyObject *__pyx_t_1 = NULL;
19003 PyObject *__pyx_t_2 = NULL;
19004 PyObject *__pyx_t_3 = NULL;
19005 PyObject *__pyx_t_4 = NULL;
19006 int __pyx_lineno = 0;
19007 const char *__pyx_filename = NULL;
19008 int __pyx_clineno = 0;
19010 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
19012 __Pyx_RefNannySetupContext(
"_err_dim", 0);
19013 __Pyx_INCREF(__pyx_v_error);
19022 __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1258, __pyx_L1_error)
19023 __Pyx_GOTREF(__pyx_t_2);
19024 __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1258, __pyx_L1_error)
19025 __Pyx_GOTREF(__pyx_t_3);
19026 __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1258, __pyx_L1_error)
19027 __Pyx_GOTREF(__pyx_t_4);
19028 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19029 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19030 __Pyx_INCREF(__pyx_v_error);
19031 __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL;
19032 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
19033 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
19034 if (likely(__pyx_t_2)) {
19035 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_3);
19036 __Pyx_INCREF(__pyx_t_2);
19037 __Pyx_INCREF(
function);
19038 __Pyx_DECREF_SET(__pyx_t_3,
function);
19041 __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
19042 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
19043 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19044 if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1258, __pyx_L1_error)
19045 __Pyx_GOTREF(__pyx_t_1);
19046 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19047 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
19048 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19049 __PYX_ERR(1, 1258, __pyx_L1_error)
19061 __Pyx_XDECREF(__pyx_t_1);
19062 __Pyx_XDECREF(__pyx_t_2);
19063 __Pyx_XDECREF(__pyx_t_3);
19064 __Pyx_XDECREF(__pyx_t_4);
19065 __Pyx_AddTraceback(
"View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
19067 __Pyx_XDECREF(__pyx_v_error);
19068 __Pyx_RefNannyFinishContext();
19070 __Pyx_PyGILState_Release(__pyx_gilstate_save);
19083 static int __pyx_memoryview_err(PyObject *__pyx_v_error,
char *__pyx_v_msg) {
19085 __Pyx_RefNannyDeclarations
19087 PyObject *__pyx_t_2 = NULL;
19088 PyObject *__pyx_t_3 = NULL;
19089 PyObject *__pyx_t_4 = NULL;
19090 PyObject *__pyx_t_5 = NULL;
19091 int __pyx_lineno = 0;
19092 const char *__pyx_filename = NULL;
19093 int __pyx_clineno = 0;
19095 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
19097 __Pyx_RefNannySetupContext(
"_err", 0);
19098 __Pyx_INCREF(__pyx_v_error);
19107 __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
19108 if (unlikely(__pyx_t_1)) {
19117 __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1263, __pyx_L1_error)
19118 __Pyx_GOTREF(__pyx_t_3);
19119 __Pyx_INCREF(__pyx_v_error);
19120 __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL;
19121 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
19122 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
19123 if (likely(__pyx_t_5)) {
19124 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_4);
19125 __Pyx_INCREF(__pyx_t_5);
19126 __Pyx_INCREF(
function);
19127 __Pyx_DECREF_SET(__pyx_t_4,
function);
19130 __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
19131 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
19132 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19133 if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1263, __pyx_L1_error)
19134 __Pyx_GOTREF(__pyx_t_2);
19135 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19136 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
19137 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19138 __PYX_ERR(1, 1263, __pyx_L1_error)
19157 __Pyx_Raise(__pyx_v_error, 0, 0, 0);
19158 __PYX_ERR(1, 1265, __pyx_L1_error)
19171 __Pyx_XDECREF(__pyx_t_2);
19172 __Pyx_XDECREF(__pyx_t_3);
19173 __Pyx_XDECREF(__pyx_t_4);
19174 __Pyx_XDECREF(__pyx_t_5);
19175 __Pyx_AddTraceback(
"View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename);
19177 __Pyx_XDECREF(__pyx_v_error);
19178 __Pyx_RefNannyFinishContext();
19180 __Pyx_PyGILState_Release(__pyx_gilstate_save);
19193 static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst,
int __pyx_v_src_ndim,
int __pyx_v_dst_ndim,
int __pyx_v_dtype_is_object) {
19194 void *__pyx_v_tmpdata;
19195 size_t __pyx_v_itemsize;
19197 char __pyx_v_order;
19198 int __pyx_v_broadcasting;
19199 int __pyx_v_direct_copy;
19200 __Pyx_memviewslice __pyx_v_tmp;
19203 Py_ssize_t __pyx_t_1;
19211 int __pyx_lineno = 0;
19212 const char *__pyx_filename = NULL;
19213 int __pyx_clineno = 0;
19222 __pyx_v_tmpdata = NULL;
19231 __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
19232 __pyx_v_itemsize = __pyx_t_1;
19241 __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim);
19250 __pyx_v_broadcasting = 0;
19259 __pyx_v_direct_copy = 0;
19268 __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
19278 __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim);
19297 __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
19307 __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim);
19326 __pyx_t_3 = __pyx_v_dst_ndim;
19327 __pyx_t_4 = __pyx_v_src_ndim;
19328 if (((__pyx_t_3 > __pyx_t_4) != 0)) {
19329 __pyx_t_5 = __pyx_t_3;
19331 __pyx_t_5 = __pyx_t_4;
19333 __pyx_v_ndim = __pyx_t_5;
19342 __pyx_t_5 = __pyx_v_ndim;
19343 __pyx_t_3 = __pyx_t_5;
19344 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19345 __pyx_v_i = __pyx_t_4;
19354 __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
19364 __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
19374 __pyx_v_broadcasting = 1;
19383 (__pyx_v_src.strides[__pyx_v_i]) = 0;
19403 __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i]));
if (unlikely(__pyx_t_6 == ((
int)-1))) __PYX_ERR(1, 1297, __pyx_L1_error)
19423 __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
19433 __pyx_t_6 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((
char *)
"Dimension %d is not direct"), __pyx_v_i);
if (unlikely(__pyx_t_6 == ((
int)-1))) __PYX_ERR(1, 1300, __pyx_L1_error)
19452 __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
19462 __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
19472 __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim);
19490 __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim);
if (unlikely(__pyx_t_7 == ((
void *)NULL))) __PYX_ERR(1, 1307, __pyx_L1_error)
19491 __pyx_v_tmpdata = __pyx_t_7;
19500 __pyx_v_src = __pyx_v_tmp;
19518 __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
19528 __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src,
'C', __pyx_v_ndim) != 0);
19538 __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst,
'C', __pyx_v_ndim);
19557 __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src,
'F', __pyx_v_ndim) != 0);
19567 __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst,
'F', __pyx_v_ndim);
19586 __pyx_t_2 = (__pyx_v_direct_copy != 0);
19596 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
19605 (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim)));
19614 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
19623 free(__pyx_v_tmpdata);
19660 __pyx_t_2 = (__pyx_v_order ==
'F');
19662 __pyx_t_2 = (
'F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
19664 __pyx_t_8 = (__pyx_t_2 != 0);
19674 __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src));
if (unlikely(__pyx_t_5 == ((
int)0))) __PYX_ERR(1, 1329, __pyx_L1_error)
19683 __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst));
if (unlikely(__pyx_t_5 == ((
int)0))) __PYX_ERR(1, 1330, __pyx_L1_error)
19701 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
19710 copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
19719 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
19728 free(__pyx_v_tmpdata);
19752 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
19754 __Pyx_AddTraceback(
"View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename);
19756 __Pyx_PyGILState_Release(__pyx_gilstate_save);
19772 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice,
int __pyx_v_ndim,
int __pyx_v_ndim_other) {
19774 int __pyx_v_offset;
19786 __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim);
19795 for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
19796 __pyx_v_i = __pyx_t_1;
19805 (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]);
19814 (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]);
19823 (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]);
19833 __pyx_t_1 = __pyx_v_offset;
19834 __pyx_t_2 = __pyx_t_1;
19835 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
19836 __pyx_v_i = __pyx_t_3;
19845 (__pyx_v_mslice->shape[__pyx_v_i]) = 1;
19854 (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]);
19863 (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1
L;
19885 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst,
int __pyx_v_dtype_is_object,
int __pyx_v_ndim,
int __pyx_v_inc) {
19895 __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
19905 __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc);
19935 static void __pyx_memoryview_refcount_objects_in_slice_with_gil(
char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides,
int __pyx_v_ndim,
int __pyx_v_inc) {
19936 __Pyx_RefNannyDeclarations
19938 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
19940 __Pyx_RefNannySetupContext(
"refcount_objects_in_slice_with_gil", 0);
19949 __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc);
19960 __Pyx_RefNannyFinishContext();
19962 __Pyx_PyGILState_Release(__pyx_gilstate_save);
19974 static void __pyx_memoryview_refcount_objects_in_slice(
char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides,
int __pyx_v_ndim,
int __pyx_v_inc) {
19975 CYTHON_UNUSED Py_ssize_t __pyx_v_i;
19976 __Pyx_RefNannyDeclarations
19977 Py_ssize_t __pyx_t_1;
19978 Py_ssize_t __pyx_t_2;
19979 Py_ssize_t __pyx_t_3;
19981 __Pyx_RefNannySetupContext(
"refcount_objects_in_slice", 0);
19990 __pyx_t_1 = (__pyx_v_shape[0]);
19991 __pyx_t_2 = __pyx_t_1;
19992 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
19993 __pyx_v_i = __pyx_t_3;
20002 __pyx_t_4 = ((__pyx_v_ndim == 1) != 0);
20012 __pyx_t_4 = (__pyx_v_inc != 0);
20022 Py_INCREF((((PyObject **)__pyx_v_data)[0]));
20042 Py_DECREF((((PyObject **)__pyx_v_data)[0]));
20072 __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc);
20083 __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0]));
20095 __Pyx_RefNannyFinishContext();
20106 static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst,
int __pyx_v_ndim,
size_t __pyx_v_itemsize,
void *__pyx_v_item,
int __pyx_v_dtype_is_object) {
20115 __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
20124 __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item);
20133 __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
20154 static void __pyx_memoryview__slice_assign_scalar(
char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides,
int __pyx_v_ndim,
size_t __pyx_v_itemsize,
void *__pyx_v_item) {
20155 CYTHON_UNUSED Py_ssize_t __pyx_v_i;
20156 Py_ssize_t __pyx_v_stride;
20157 Py_ssize_t __pyx_v_extent;
20159 Py_ssize_t __pyx_t_2;
20160 Py_ssize_t __pyx_t_3;
20161 Py_ssize_t __pyx_t_4;
20170 __pyx_v_stride = (__pyx_v_strides[0]);
20179 __pyx_v_extent = (__pyx_v_shape[0]);
20188 __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
20198 __pyx_t_2 = __pyx_v_extent;
20199 __pyx_t_3 = __pyx_t_2;
20200 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
20201 __pyx_v_i = __pyx_t_4;
20210 (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize));
20219 __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
20240 __pyx_t_2 = __pyx_v_extent;
20241 __pyx_t_3 = __pyx_t_2;
20242 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
20243 __pyx_v_i = __pyx_t_4;
20252 __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item);
20261 __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
20284 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
20285 static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {
"__pyx_unpickle_Enum", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, METH_VARARGS|METH_KEYWORDS, 0};
20286 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
20287 PyObject *__pyx_v___pyx_type = 0;
20288 long __pyx_v___pyx_checksum;
20289 PyObject *__pyx_v___pyx_state = 0;
20290 int __pyx_lineno = 0;
20291 const char *__pyx_filename = NULL;
20292 int __pyx_clineno = 0;
20293 PyObject *__pyx_r = 0;
20294 __Pyx_RefNannyDeclarations
20295 __Pyx_RefNannySetupContext(
"__pyx_unpickle_Enum (wrapper)", 0);
20297 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
20298 PyObject* values[3] = {0,0,0};
20299 if (unlikely(__pyx_kwds)) {
20300 Py_ssize_t kw_args;
20301 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
20302 switch (pos_args) {
20303 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
20304 CYTHON_FALLTHROUGH;
20305 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
20306 CYTHON_FALLTHROUGH;
20307 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
20308 CYTHON_FALLTHROUGH;
20310 default:
goto __pyx_L5_argtuple_error;
20312 kw_args = PyDict_Size(__pyx_kwds);
20313 switch (pos_args) {
20315 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
20316 else goto __pyx_L5_argtuple_error;
20317 CYTHON_FALLTHROUGH;
20319 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
20321 __Pyx_RaiseArgtupleInvalid(
"__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
20323 CYTHON_FALLTHROUGH;
20325 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
20327 __Pyx_RaiseArgtupleInvalid(
"__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
20330 if (unlikely(kw_args > 0)) {
20331 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__pyx_unpickle_Enum") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
20333 }
else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
20334 goto __pyx_L5_argtuple_error;
20336 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
20337 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
20338 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
20340 __pyx_v___pyx_type = values[0];
20341 __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]);
if (unlikely((__pyx_v___pyx_checksum == (
long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
20342 __pyx_v___pyx_state = values[2];
20344 goto __pyx_L4_argument_unpacking_done;
20345 __pyx_L5_argtuple_error:;
20346 __Pyx_RaiseArgtupleInvalid(
"__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
20348 __Pyx_AddTraceback(
"View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
20349 __Pyx_RefNannyFinishContext();
20351 __pyx_L4_argument_unpacking_done:;
20352 __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
20355 __Pyx_RefNannyFinishContext();
20359 static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type,
long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
20360 PyObject *__pyx_v___pyx_PickleError = 0;
20361 PyObject *__pyx_v___pyx_result = 0;
20362 PyObject *__pyx_r = NULL;
20363 __Pyx_RefNannyDeclarations
20365 PyObject *__pyx_t_2 = NULL;
20366 PyObject *__pyx_t_3 = NULL;
20367 PyObject *__pyx_t_4 = NULL;
20368 PyObject *__pyx_t_5 = NULL;
20370 int __pyx_lineno = 0;
20371 const char *__pyx_filename = NULL;
20372 int __pyx_clineno = 0;
20373 __Pyx_RefNannySetupContext(
"__pyx_unpickle_Enum", 0);
20382 __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xb068931) != 0);
20392 __pyx_t_2 = PyList_New(1);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
20393 __Pyx_GOTREF(__pyx_t_2);
20394 __Pyx_INCREF(__pyx_n_s_PickleError);
20395 __Pyx_GIVEREF(__pyx_n_s_PickleError);
20396 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
20397 __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
20398 __Pyx_GOTREF(__pyx_t_3);
20399 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20400 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
20401 __Pyx_GOTREF(__pyx_t_2);
20402 __Pyx_INCREF(__pyx_t_2);
20403 __pyx_v___pyx_PickleError = __pyx_t_2;
20404 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20405 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20414 __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
20415 __Pyx_GOTREF(__pyx_t_2);
20416 __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_t_2);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
20417 __Pyx_GOTREF(__pyx_t_4);
20418 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20419 __Pyx_INCREF(__pyx_v___pyx_PickleError);
20420 __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
20421 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
20422 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
20423 if (likely(__pyx_t_5)) {
20424 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_2);
20425 __Pyx_INCREF(__pyx_t_5);
20426 __Pyx_INCREF(
function);
20427 __Pyx_DECREF_SET(__pyx_t_2,
function);
20430 __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
20431 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
20432 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
20433 if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
20434 __Pyx_GOTREF(__pyx_t_3);
20435 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20436 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
20437 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20438 __PYX_ERR(1, 6, __pyx_L1_error)
20456 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
20457 __Pyx_GOTREF(__pyx_t_2);
20459 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
20460 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
20461 if (likely(__pyx_t_4)) {
20462 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_2);
20463 __Pyx_INCREF(__pyx_t_4);
20464 __Pyx_INCREF(
function);
20465 __Pyx_DECREF_SET(__pyx_t_2,
function);
20468 __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
20469 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
20470 if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
20471 __Pyx_GOTREF(__pyx_t_3);
20472 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20473 __pyx_v___pyx_result = __pyx_t_3;
20483 __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
20484 __pyx_t_6 = (__pyx_t_1 != 0);
20494 if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError,
"Expected %.16s, got %.200s",
"tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
20495 __pyx_t_3 = __pyx_unpickle_Enum__set_state(((
struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state));
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
20496 __Pyx_GOTREF(__pyx_t_3);
20497 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20515 __Pyx_XDECREF(__pyx_r);
20516 __Pyx_INCREF(__pyx_v___pyx_result);
20517 __pyx_r = __pyx_v___pyx_result;
20528 __Pyx_XDECREF(__pyx_t_2);
20529 __Pyx_XDECREF(__pyx_t_3);
20530 __Pyx_XDECREF(__pyx_t_4);
20531 __Pyx_XDECREF(__pyx_t_5);
20532 __Pyx_AddTraceback(
"View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
20535 __Pyx_XDECREF(__pyx_v___pyx_PickleError);
20536 __Pyx_XDECREF(__pyx_v___pyx_result);
20537 __Pyx_XGIVEREF(__pyx_r);
20538 __Pyx_RefNannyFinishContext();
20550 static PyObject *__pyx_unpickle_Enum__set_state(
struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
20551 PyObject *__pyx_r = NULL;
20552 __Pyx_RefNannyDeclarations
20553 PyObject *__pyx_t_1 = NULL;
20555 Py_ssize_t __pyx_t_3;
20558 PyObject *__pyx_t_6 = NULL;
20559 PyObject *__pyx_t_7 = NULL;
20560 PyObject *__pyx_t_8 = NULL;
20561 int __pyx_lineno = 0;
20562 const char *__pyx_filename = NULL;
20563 int __pyx_clineno = 0;
20564 __Pyx_RefNannySetupContext(
"__pyx_unpickle_Enum__set_state", 0);
20573 if (unlikely(__pyx_v___pyx_state == Py_None)) {
20574 PyErr_SetString(PyExc_TypeError,
"'NoneType' object is not subscriptable");
20575 __PYX_ERR(1, 12, __pyx_L1_error)
20577 __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0,
long, 1, __Pyx_PyInt_From_long, 0, 0, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
20578 __Pyx_GOTREF(__pyx_t_1);
20579 __Pyx_GIVEREF(__pyx_t_1);
20580 __Pyx_GOTREF(__pyx_v___pyx_result->name);
20581 __Pyx_DECREF(__pyx_v___pyx_result->name);
20582 __pyx_v___pyx_result->name = __pyx_t_1;
20591 if (unlikely(__pyx_v___pyx_state == Py_None)) {
20592 PyErr_SetString(PyExc_TypeError,
"object of type 'NoneType' has no len()");
20593 __PYX_ERR(1, 13, __pyx_L1_error)
20595 __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state);
if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
20596 __pyx_t_4 = ((__pyx_t_3 > 1) != 0);
20599 __pyx_t_2 = __pyx_t_4;
20600 goto __pyx_L4_bool_binop_done;
20602 __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict);
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
20603 __pyx_t_5 = (__pyx_t_4 != 0);
20604 __pyx_t_2 = __pyx_t_5;
20605 __pyx_L4_bool_binop_done:;
20613 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
20614 __Pyx_GOTREF(__pyx_t_6);
20615 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update);
if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
20616 __Pyx_GOTREF(__pyx_t_7);
20617 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20618 if (unlikely(__pyx_v___pyx_state == Py_None)) {
20619 PyErr_SetString(PyExc_TypeError,
"'NoneType' object is not subscriptable");
20620 __PYX_ERR(1, 14, __pyx_L1_error)
20622 __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1,
long, 1, __Pyx_PyInt_From_long, 0, 0, 0);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
20623 __Pyx_GOTREF(__pyx_t_6);
20625 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
20626 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
20627 if (likely(__pyx_t_8)) {
20628 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_7);
20629 __Pyx_INCREF(__pyx_t_8);
20630 __Pyx_INCREF(
function);
20631 __Pyx_DECREF_SET(__pyx_t_7,
function);
20634 __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
20635 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
20636 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20637 if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
20638 __Pyx_GOTREF(__pyx_t_1);
20639 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20640 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20659 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
20662 __Pyx_XDECREF(__pyx_t_1);
20663 __Pyx_XDECREF(__pyx_t_6);
20664 __Pyx_XDECREF(__pyx_t_7);
20665 __Pyx_XDECREF(__pyx_t_8);
20666 __Pyx_AddTraceback(
"View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
20669 __Pyx_XGIVEREF(__pyx_r);
20670 __Pyx_RefNannyFinishContext();
20674 static PyObject *__pyx_tp_new_15superluWrappers_cSparseMatrix(PyTypeObject *t, PyObject *a, PyObject *k) {
20676 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
20677 o = (*t->tp_alloc)(t, 0);
20679 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
20681 if (unlikely(!o))
return 0;
20682 if (unlikely(__pyx_pw_15superluWrappers_13cSparseMatrix_1__cinit__(o, a, k) < 0))
goto bad;
20685 Py_DECREF(o); o = 0;
20689 static void __pyx_tp_dealloc_15superluWrappers_cSparseMatrix(PyObject *o) {
20690 #if CYTHON_USE_TP_FINALIZE
20691 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
20692 if (PyObject_CallFinalizerFromDealloc(o))
return;
20695 (*Py_TYPE(o)->tp_free)(o);
20698 static PyMethodDef __pyx_methods_15superluWrappers_cSparseMatrix[] = {
20699 {
"__reduce_cython__", (PyCFunction)__pyx_pw_15superluWrappers_13cSparseMatrix_3__reduce_cython__, METH_NOARGS, 0},
20700 {
"__setstate_cython__", (PyCFunction)__pyx_pw_15superluWrappers_13cSparseMatrix_5__setstate_cython__, METH_O, 0},
20704 static PyTypeObject __pyx_type_15superluWrappers_cSparseMatrix = {
20705 PyVarObject_HEAD_INIT(0, 0)
20706 "superluWrappers.cSparseMatrix",
20707 sizeof(
struct __pyx_obj_15superluWrappers_cSparseMatrix),
20709 __pyx_tp_dealloc_15superluWrappers_cSparseMatrix,
20710 #
if PY_VERSION_HEX < 0x030800b4
20713 #
if PY_VERSION_HEX >= 0x030800b4
20718 #
if PY_MAJOR_VERSION < 3
20721 #
if PY_MAJOR_VERSION >= 3
20734 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
20742 __pyx_methods_15superluWrappers_cSparseMatrix,
20752 __pyx_tp_new_15superluWrappers_cSparseMatrix,
20762 #
if PY_VERSION_HEX >= 0x030400a1
20765 #
if PY_VERSION_HEX >= 0x030800b1
20768 #
if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
20772 static struct __pyx_vtabstruct_15superluWrappers_SparseFactor __pyx_vtable_15superluWrappers_SparseFactor;
20774 static PyObject *__pyx_tp_new_15superluWrappers_SparseFactor(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
20775 struct __pyx_obj_15superluWrappers_SparseFactor *p;
20777 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
20778 o = (*t->tp_alloc)(t, 0);
20780 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
20782 if (unlikely(!o))
return 0;
20783 p = ((
struct __pyx_obj_15superluWrappers_SparseFactor *)o);
20784 p->__pyx_vtab = __pyx_vtabptr_15superluWrappers_SparseFactor;
20788 static void __pyx_tp_dealloc_15superluWrappers_SparseFactor(PyObject *o) {
20789 #if CYTHON_USE_TP_FINALIZE
20790 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
20791 if (PyObject_CallFinalizerFromDealloc(o))
return;
20794 (*Py_TYPE(o)->tp_free)(o);
20797 static PyObject *__pyx_getprop_15superluWrappers_12SparseFactor_dim(PyObject *o, CYTHON_UNUSED
void *x) {
20798 return __pyx_pw_15superluWrappers_12SparseFactor_3dim_1__get__(o);
20801 static int __pyx_setprop_15superluWrappers_12SparseFactor_dim(PyObject *o, PyObject *
v, CYTHON_UNUSED
void *x) {
20803 return __pyx_pw_15superluWrappers_12SparseFactor_3dim_3__set__(o,
v);
20806 PyErr_SetString(PyExc_NotImplementedError,
"__del__");
20811 static PyMethodDef __pyx_methods_15superluWrappers_SparseFactor[] = {
20812 {
"__reduce_cython__", (PyCFunction)__pyx_pw_15superluWrappers_12SparseFactor_3__reduce_cython__, METH_NOARGS, 0},
20813 {
"__setstate_cython__", (PyCFunction)__pyx_pw_15superluWrappers_12SparseFactor_5__setstate_cython__, METH_O, 0},
20817 static struct PyGetSetDef __pyx_getsets_15superluWrappers_SparseFactor[] = {
20818 {(
char *)
"dim", __pyx_getprop_15superluWrappers_12SparseFactor_dim, __pyx_setprop_15superluWrappers_12SparseFactor_dim, (
char *)0, 0},
20822 static PyTypeObject __pyx_type_15superluWrappers_SparseFactor = {
20823 PyVarObject_HEAD_INIT(0, 0)
20824 "superluWrappers.SparseFactor",
20825 sizeof(
struct __pyx_obj_15superluWrappers_SparseFactor),
20827 __pyx_tp_dealloc_15superluWrappers_SparseFactor,
20828 #
if PY_VERSION_HEX < 0x030800b4
20831 #
if PY_VERSION_HEX >= 0x030800b4
20836 #
if PY_MAJOR_VERSION < 3
20839 #
if PY_MAJOR_VERSION >= 3
20852 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
20860 __pyx_methods_15superluWrappers_SparseFactor,
20862 __pyx_getsets_15superluWrappers_SparseFactor,
20868 __pyx_pw_15superluWrappers_12SparseFactor_1__init__,
20870 __pyx_tp_new_15superluWrappers_SparseFactor,
20880 #
if PY_VERSION_HEX >= 0x030400a1
20883 #
if PY_VERSION_HEX >= 0x030800b1
20886 #
if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
20890 static struct __pyx_vtabstruct_array __pyx_vtable_array;
20892 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
20893 struct __pyx_array_obj *p;
20895 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
20896 o = (*t->tp_alloc)(t, 0);
20898 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
20900 if (unlikely(!o))
return 0;
20901 p = ((
struct __pyx_array_obj *)o);
20902 p->__pyx_vtab = __pyx_vtabptr_array;
20903 p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
20904 p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
20905 if (unlikely(__pyx_array___cinit__(o, a, k) < 0))
goto bad;
20908 Py_DECREF(o); o = 0;
20912 static void __pyx_tp_dealloc_array(PyObject *o) {
20913 struct __pyx_array_obj *p = (
struct __pyx_array_obj *)o;
20914 #if CYTHON_USE_TP_FINALIZE
20915 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
20916 if (PyObject_CallFinalizerFromDealloc(o))
return;
20920 PyObject *etype, *eval, *etb;
20921 PyErr_Fetch(&etype, &eval, &etb);
20922 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
20923 __pyx_array___dealloc__(o);
20924 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
20925 PyErr_Restore(etype, eval, etb);
20928 Py_CLEAR(p->_format);
20929 (*Py_TYPE(o)->tp_free)(o);
20931 static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
20933 PyObject *x = PyInt_FromSsize_t(i);
if(!x)
return 0;
20934 r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
20939 static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *
v) {
20941 return __pyx_array___setitem__(o, i,
v);
20944 PyErr_Format(PyExc_NotImplementedError,
20945 "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
20950 static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *
n) {
20951 PyObject *
v = __Pyx_PyObject_GenericGetAttr(o,
n);
20952 if (!
v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
20954 v = __pyx_array___getattr__(o,
n);
20959 static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED
void *x) {
20960 return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o);
20963 static PyMethodDef __pyx_methods_array[] = {
20964 {
"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0},
20965 {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0},
20966 {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0},
20970 static struct PyGetSetDef __pyx_getsets_array[] = {
20971 {(
char *)
"memview", __pyx_getprop___pyx_array_memview, 0, (
char *)0, 0},
20975 static PySequenceMethods __pyx_tp_as_sequence_array = {
20976 __pyx_array___len__,
20979 __pyx_sq_item_array,
20988 static PyMappingMethods __pyx_tp_as_mapping_array = {
20989 __pyx_array___len__,
20990 __pyx_array___getitem__,
20991 __pyx_mp_ass_subscript_array,
20994 static PyBufferProcs __pyx_tp_as_buffer_array = {
20995 #if PY_MAJOR_VERSION < 3
20998 #if PY_MAJOR_VERSION < 3
21001 #if PY_MAJOR_VERSION < 3
21004 #if PY_MAJOR_VERSION < 3
21007 __pyx_array_getbuffer,
21011 static PyTypeObject __pyx_type___pyx_array = {
21012 PyVarObject_HEAD_INIT(0, 0)
21013 "superluWrappers.array",
21014 sizeof(
struct __pyx_array_obj),
21016 __pyx_tp_dealloc_array,
21017 #
if PY_VERSION_HEX < 0x030800b4
21020 #
if PY_VERSION_HEX >= 0x030800b4
21025 #
if PY_MAJOR_VERSION < 3
21028 #
if PY_MAJOR_VERSION >= 3
21033 &__pyx_tp_as_sequence_array,
21034 &__pyx_tp_as_mapping_array,
21038 __pyx_tp_getattro_array,
21040 &__pyx_tp_as_buffer_array,
21041 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
21049 __pyx_methods_array,
21051 __pyx_getsets_array,
21059 __pyx_tp_new_array,
21069 #
if PY_VERSION_HEX >= 0x030400a1
21072 #
if PY_VERSION_HEX >= 0x030800b1
21075 #
if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
21080 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
21081 struct __pyx_MemviewEnum_obj *p;
21083 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
21084 o = (*t->tp_alloc)(t, 0);
21086 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
21088 if (unlikely(!o))
return 0;
21089 p = ((
struct __pyx_MemviewEnum_obj *)o);
21090 p->name = Py_None; Py_INCREF(Py_None);
21094 static void __pyx_tp_dealloc_Enum(PyObject *o) {
21095 struct __pyx_MemviewEnum_obj *p = (
struct __pyx_MemviewEnum_obj *)o;
21096 #if CYTHON_USE_TP_FINALIZE
21097 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
21098 if (PyObject_CallFinalizerFromDealloc(o))
return;
21101 PyObject_GC_UnTrack(o);
21103 (*Py_TYPE(o)->tp_free)(o);
21106 static int __pyx_tp_traverse_Enum(PyObject *o, visitproc
v,
void *a) {
21108 struct __pyx_MemviewEnum_obj *p = (
struct __pyx_MemviewEnum_obj *)o;
21110 e = (*v)(p->name, a);
if (e)
return e;
21115 static int __pyx_tp_clear_Enum(PyObject *o) {
21117 struct __pyx_MemviewEnum_obj *p = (
struct __pyx_MemviewEnum_obj *)o;
21118 tmp = ((PyObject*)p->name);
21119 p->name = Py_None; Py_INCREF(Py_None);
21124 static PyMethodDef __pyx_methods_Enum[] = {
21125 {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0},
21126 {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0},
21130 static PyTypeObject __pyx_type___pyx_MemviewEnum = {
21131 PyVarObject_HEAD_INIT(0, 0)
21132 "superluWrappers.Enum",
21133 sizeof(
struct __pyx_MemviewEnum_obj),
21135 __pyx_tp_dealloc_Enum,
21136 #
if PY_VERSION_HEX < 0x030800b4
21139 #
if PY_VERSION_HEX >= 0x030800b4
21144 #
if PY_MAJOR_VERSION < 3
21147 #
if PY_MAJOR_VERSION >= 3
21150 __pyx_MemviewEnum___repr__,
21160 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
21162 __pyx_tp_traverse_Enum,
21163 __pyx_tp_clear_Enum,
21168 __pyx_methods_Enum,
21176 __pyx_MemviewEnum___init__,
21188 #
if PY_VERSION_HEX >= 0x030400a1
21191 #
if PY_VERSION_HEX >= 0x030800b1
21194 #
if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
21198 static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
21200 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
21201 struct __pyx_memoryview_obj *p;
21203 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
21204 o = (*t->tp_alloc)(t, 0);
21206 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
21208 if (unlikely(!o))
return 0;
21209 p = ((
struct __pyx_memoryview_obj *)o);
21210 p->__pyx_vtab = __pyx_vtabptr_memoryview;
21211 p->obj = Py_None; Py_INCREF(Py_None);
21212 p->_size = Py_None; Py_INCREF(Py_None);
21213 p->_array_interface = Py_None; Py_INCREF(Py_None);
21214 p->view.obj = NULL;
21215 if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0))
goto bad;
21218 Py_DECREF(o); o = 0;
21222 static void __pyx_tp_dealloc_memoryview(PyObject *o) {
21223 struct __pyx_memoryview_obj *p = (
struct __pyx_memoryview_obj *)o;
21224 #if CYTHON_USE_TP_FINALIZE
21225 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
21226 if (PyObject_CallFinalizerFromDealloc(o))
return;
21229 PyObject_GC_UnTrack(o);
21231 PyObject *etype, *eval, *etb;
21232 PyErr_Fetch(&etype, &eval, &etb);
21233 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
21234 __pyx_memoryview___dealloc__(o);
21235 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
21236 PyErr_Restore(etype, eval, etb);
21239 Py_CLEAR(p->_size);
21240 Py_CLEAR(p->_array_interface);
21241 (*Py_TYPE(o)->tp_free)(o);
21244 static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc
v,
void *a) {
21246 struct __pyx_memoryview_obj *p = (
struct __pyx_memoryview_obj *)o;
21248 e = (*v)(p->obj, a);
if (e)
return e;
21251 e = (*v)(p->_size, a);
if (e)
return e;
21253 if (p->_array_interface) {
21254 e = (*v)(p->_array_interface, a);
if (e)
return e;
21257 e = (*v)(p->view.obj, a);
if (e)
return e;
21262 static int __pyx_tp_clear_memoryview(PyObject *o) {
21264 struct __pyx_memoryview_obj *p = (
struct __pyx_memoryview_obj *)o;
21265 tmp = ((PyObject*)p->obj);
21266 p->obj = Py_None; Py_INCREF(Py_None);
21268 tmp = ((PyObject*)p->_size);
21269 p->_size = Py_None; Py_INCREF(Py_None);
21271 tmp = ((PyObject*)p->_array_interface);
21272 p->_array_interface = Py_None; Py_INCREF(Py_None);
21274 Py_CLEAR(p->view.obj);
21277 static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
21279 PyObject *x = PyInt_FromSsize_t(i);
if(!x)
return 0;
21280 r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
21285 static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *
v) {
21287 return __pyx_memoryview___setitem__(o, i,
v);
21290 PyErr_Format(PyExc_NotImplementedError,
21291 "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
21296 static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED
void *x) {
21297 return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o);
21300 static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED
void *x) {
21301 return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o);
21304 static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED
void *x) {
21305 return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o);
21308 static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED
void *x) {
21309 return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o);
21312 static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED
void *x) {
21313 return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o);
21316 static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED
void *x) {
21317 return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o);
21320 static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED
void *x) {
21321 return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o);
21324 static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED
void *x) {
21325 return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o);
21328 static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED
void *x) {
21329 return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o);
21332 static PyMethodDef __pyx_methods_memoryview[] = {
21333 {
"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0},
21334 {
"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0},
21335 {
"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0},
21336 {
"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0},
21337 {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0},
21338 {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0},
21342 static struct PyGetSetDef __pyx_getsets_memoryview[] = {
21343 {(
char *)
"T", __pyx_getprop___pyx_memoryview_T, 0, (
char *)0, 0},
21344 {(
char *)
"base", __pyx_getprop___pyx_memoryview_base, 0, (
char *)0, 0},
21345 {(
char *)
"shape", __pyx_getprop___pyx_memoryview_shape, 0, (
char *)0, 0},
21346 {(
char *)
"strides", __pyx_getprop___pyx_memoryview_strides, 0, (
char *)0, 0},
21347 {(
char *)
"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (
char *)0, 0},
21348 {(
char *)
"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (
char *)0, 0},
21349 {(
char *)
"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (
char *)0, 0},
21350 {(
char *)
"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (
char *)0, 0},
21351 {(
char *)
"size", __pyx_getprop___pyx_memoryview_size, 0, (
char *)0, 0},
21355 static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
21356 __pyx_memoryview___len__,
21359 __pyx_sq_item_memoryview,
21368 static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
21369 __pyx_memoryview___len__,
21370 __pyx_memoryview___getitem__,
21371 __pyx_mp_ass_subscript_memoryview,
21374 static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
21375 #if PY_MAJOR_VERSION < 3
21378 #if PY_MAJOR_VERSION < 3
21381 #if PY_MAJOR_VERSION < 3
21384 #if PY_MAJOR_VERSION < 3
21387 __pyx_memoryview_getbuffer,
21391 static PyTypeObject __pyx_type___pyx_memoryview = {
21392 PyVarObject_HEAD_INIT(0, 0)
21393 "superluWrappers.memoryview",
21394 sizeof(
struct __pyx_memoryview_obj),
21396 __pyx_tp_dealloc_memoryview,
21397 #
if PY_VERSION_HEX < 0x030800b4
21400 #
if PY_VERSION_HEX >= 0x030800b4
21405 #
if PY_MAJOR_VERSION < 3
21408 #
if PY_MAJOR_VERSION >= 3
21411 __pyx_memoryview___repr__,
21413 &__pyx_tp_as_sequence_memoryview,
21414 &__pyx_tp_as_mapping_memoryview,
21417 __pyx_memoryview___str__,
21420 &__pyx_tp_as_buffer_memoryview,
21421 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
21423 __pyx_tp_traverse_memoryview,
21424 __pyx_tp_clear_memoryview,
21429 __pyx_methods_memoryview,
21431 __pyx_getsets_memoryview,
21439 __pyx_tp_new_memoryview,
21449 #
if PY_VERSION_HEX >= 0x030400a1
21452 #
if PY_VERSION_HEX >= 0x030800b1
21455 #
if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
21459 static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;
21461 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
21462 struct __pyx_memoryviewslice_obj *p;
21463 PyObject *o = __pyx_tp_new_memoryview(t, a, k);
21464 if (unlikely(!o))
return 0;
21465 p = ((
struct __pyx_memoryviewslice_obj *)o);
21466 p->__pyx_base.__pyx_vtab = (
struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
21467 p->from_object = Py_None; Py_INCREF(Py_None);
21468 p->from_slice.memview = NULL;
21472 static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
21473 struct __pyx_memoryviewslice_obj *p = (
struct __pyx_memoryviewslice_obj *)o;
21474 #if CYTHON_USE_TP_FINALIZE
21475 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
21476 if (PyObject_CallFinalizerFromDealloc(o))
return;
21479 PyObject_GC_UnTrack(o);
21481 PyObject *etype, *eval, *etb;
21482 PyErr_Fetch(&etype, &eval, &etb);
21483 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
21484 __pyx_memoryviewslice___dealloc__(o);
21485 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
21486 PyErr_Restore(etype, eval, etb);
21488 Py_CLEAR(p->from_object);
21489 PyObject_GC_Track(o);
21490 __pyx_tp_dealloc_memoryview(o);
21493 static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc
v,
void *a) {
21495 struct __pyx_memoryviewslice_obj *p = (
struct __pyx_memoryviewslice_obj *)o;
21496 e = __pyx_tp_traverse_memoryview(o,
v, a);
if (e)
return e;
21497 if (p->from_object) {
21498 e = (*v)(p->from_object, a);
if (e)
return e;
21503 static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
21505 struct __pyx_memoryviewslice_obj *p = (
struct __pyx_memoryviewslice_obj *)o;
21506 __pyx_tp_clear_memoryview(o);
21507 tmp = ((PyObject*)p->from_object);
21508 p->from_object = Py_None; Py_INCREF(Py_None);
21510 __PYX_XDEC_MEMVIEW(&p->from_slice, 1);
21514 static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED
void *x) {
21515 return __pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(o);
21518 static PyMethodDef __pyx_methods__memoryviewslice[] = {
21519 {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0},
21520 {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0},
21524 static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
21525 {(
char *)
"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (
char *)0, 0},
21529 static PyTypeObject __pyx_type___pyx_memoryviewslice = {
21530 PyVarObject_HEAD_INIT(0, 0)
21531 "superluWrappers._memoryviewslice",
21532 sizeof(
struct __pyx_memoryviewslice_obj),
21534 __pyx_tp_dealloc__memoryviewslice,
21535 #
if PY_VERSION_HEX < 0x030800b4
21538 #
if PY_VERSION_HEX >= 0x030800b4
21543 #
if PY_MAJOR_VERSION < 3
21546 #
if PY_MAJOR_VERSION >= 3
21549 #
if CYTHON_COMPILING_IN_PYPY
21550 __pyx_memoryview___repr__,
21559 #
if CYTHON_COMPILING_IN_PYPY
21560 __pyx_memoryview___str__,
21567 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
21568 "Internal class for passing memoryview slices to Python",
21569 __pyx_tp_traverse__memoryviewslice,
21570 __pyx_tp_clear__memoryviewslice,
21575 __pyx_methods__memoryviewslice,
21577 __pyx_getsets__memoryviewslice,
21585 __pyx_tp_new__memoryviewslice,
21595 #
if PY_VERSION_HEX >= 0x030400a1
21598 #
if PY_VERSION_HEX >= 0x030800b1
21601 #
if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
21606 static PyMethodDef __pyx_methods[] = {
21610 #if PY_MAJOR_VERSION >= 3
21611 #if CYTHON_PEP489_MULTI_PHASE_INIT
21612 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def);
21613 static int __pyx_pymod_exec_superluWrappers(PyObject* module);
21614 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
21615 {Py_mod_create, (
void*)__pyx_pymod_create},
21616 {Py_mod_exec, (
void*)__pyx_pymod_exec_superluWrappers},
21621 static struct PyModuleDef __pyx_moduledef = {
21622 PyModuleDef_HEAD_INIT,
21625 #if CYTHON_PEP489_MULTI_PHASE_INIT
21631 #if CYTHON_PEP489_MULTI_PHASE_INIT
21632 __pyx_moduledef_slots,
21641 #ifndef CYTHON_SMALL_CODE
21642 #if defined(__clang__)
21643 #define CYTHON_SMALL_CODE
21644 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
21645 #define CYTHON_SMALL_CODE __attribute__((cold))
21647 #define CYTHON_SMALL_CODE
21651 static __Pyx_StringTabEntry __pyx_string_tab[] = {
21652 {&__pyx_n_s_ASCII, __pyx_k_ASCII,
sizeof(__pyx_k_ASCII), 0, 0, 1, 1},
21653 {&__pyx_kp_s_Buffer_view_does_not_expose_stri, __pyx_k_Buffer_view_does_not_expose_stri,
sizeof(__pyx_k_Buffer_view_does_not_expose_stri), 0, 0, 1, 0},
21654 {&__pyx_kp_s_Can_only_create_a_buffer_that_is, __pyx_k_Can_only_create_a_buffer_that_is,
sizeof(__pyx_k_Can_only_create_a_buffer_that_is), 0, 0, 1, 0},
21655 {&__pyx_kp_s_Cannot_assign_to_read_only_memor, __pyx_k_Cannot_assign_to_read_only_memor,
sizeof(__pyx_k_Cannot_assign_to_read_only_memor), 0, 0, 1, 0},
21656 {&__pyx_kp_s_Cannot_create_writable_memory_vi, __pyx_k_Cannot_create_writable_memory_vi,
sizeof(__pyx_k_Cannot_create_writable_memory_vi), 0, 0, 1, 0},
21657 {&__pyx_kp_s_Cannot_index_with_type_s, __pyx_k_Cannot_index_with_type_s,
sizeof(__pyx_k_Cannot_index_with_type_s), 0, 0, 1, 0},
21658 {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis,
sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1},
21659 {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr,
sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0},
21660 {&__pyx_kp_u_Format_string_allocated_too_shor, __pyx_k_Format_string_allocated_too_shor,
sizeof(__pyx_k_Format_string_allocated_too_shor), 0, 1, 0, 0},
21661 {&__pyx_kp_u_Format_string_allocated_too_shor_2, __pyx_k_Format_string_allocated_too_shor_2,
sizeof(__pyx_k_Format_string_allocated_too_shor_2), 0, 1, 0, 0},
21662 {&__pyx_n_s_ImportError, __pyx_k_ImportError,
sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
21663 {&__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_k_Incompatible_checksums_s_vs_0xb0,
sizeof(__pyx_k_Incompatible_checksums_s_vs_0xb0), 0, 0, 1, 0},
21664 {&__pyx_n_s_IndexError, __pyx_k_IndexError,
sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
21665 {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte,
sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0},
21666 {&__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr,
sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 0, 1, 0},
21667 {&__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_k_Invalid_shape_in_axis_d_d,
sizeof(__pyx_k_Invalid_shape_in_axis_d_d), 0, 0, 1, 0},
21668 {&__pyx_n_s_MemoryError, __pyx_k_MemoryError,
sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
21669 {&__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_k_MemoryView_of_r_at_0x_x,
sizeof(__pyx_k_MemoryView_of_r_at_0x_x), 0, 0, 1, 0},
21670 {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object,
sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0},
21671 {&__pyx_kp_u_Non_native_byte_order_not_suppor, __pyx_k_Non_native_byte_order_not_suppor,
sizeof(__pyx_k_Non_native_byte_order_not_suppor), 0, 1, 0, 0},
21672 {&__pyx_n_b_O, __pyx_k_O,
sizeof(__pyx_k_O), 0, 0, 0, 1},
21673 {&__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a,
sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 0, 1, 0},
21674 {&__pyx_n_s_PickleError, __pyx_k_PickleError,
sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
21675 {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError,
sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
21676 {&__pyx_n_s_SparseFactor, __pyx_k_SparseFactor,
sizeof(__pyx_k_SparseFactor), 0, 0, 1, 1},
21677 {&__pyx_n_s_SparseMatrix, __pyx_k_SparseMatrix,
sizeof(__pyx_k_SparseMatrix), 0, 0, 1, 1},
21678 {&__pyx_n_s_SparseMatrix___init, __pyx_k_SparseMatrix___init,
sizeof(__pyx_k_SparseMatrix___init), 0, 0, 1, 1},
21679 {&__pyx_n_s_SparseMatrix_fwrite, __pyx_k_SparseMatrix_fwrite,
sizeof(__pyx_k_SparseMatrix_fwrite), 0, 0, 1, 1},
21680 {&__pyx_n_s_SparseMatrix_getCSRrepresentatio, __pyx_k_SparseMatrix_getCSRrepresentatio,
sizeof(__pyx_k_SparseMatrix_getCSRrepresentatio), 0, 0, 1, 1},
21681 {&__pyx_n_s_SparseMatrix_getSubMatCSRreprese, __pyx_k_SparseMatrix_getSubMatCSRreprese,
sizeof(__pyx_k_SparseMatrix_getSubMatCSRreprese), 0, 0, 1, 1},
21682 {&__pyx_n_s_SparseMatrix_matvec, __pyx_k_SparseMatrix_matvec,
sizeof(__pyx_k_SparseMatrix_matvec), 0, 0, 1, 1},
21683 {&__pyx_n_s_TypeError, __pyx_k_TypeError,
sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
21684 {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object,
sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0},
21685 {&__pyx_n_s_ValueError, __pyx_k_ValueError,
sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
21686 {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView,
sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1},
21687 {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer,
sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1},
21688 {&__pyx_n_s_base, __pyx_k_base,
sizeof(__pyx_k_base), 0, 0, 1, 1},
21689 {&__pyx_n_s_c, __pyx_k_c,
sizeof(__pyx_k_c), 0, 0, 1, 1},
21690 {&__pyx_n_u_c, __pyx_k_c,
sizeof(__pyx_k_c), 0, 1, 0, 1},
21691 {&__pyx_n_s_cSparseMatrix, __pyx_k_cSparseMatrix,
sizeof(__pyx_k_cSparseMatrix), 0, 0, 1, 1},
21692 {&__pyx_n_s_cSparseMatrix_2, __pyx_k_cSparseMatrix_2,
sizeof(__pyx_k_cSparseMatrix_2), 0, 0, 1, 1},
21693 {&__pyx_n_s_class, __pyx_k_class,
sizeof(__pyx_k_class), 0, 0, 1, 1},
21694 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback,
sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
21695 {&__pyx_n_s_colind, __pyx_k_colind,
sizeof(__pyx_k_colind), 0, 0, 1, 1},
21696 {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct,
sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0},
21697 {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect,
sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0},
21698 {&__pyx_kp_s_d_d_13_8e, __pyx_k_d_d_13_8e,
sizeof(__pyx_k_d_d_13_8e), 0, 0, 1, 0},
21699 {&__pyx_n_s_dict, __pyx_k_dict,
sizeof(__pyx_k_dict), 0, 0, 1, 1},
21700 {&__pyx_n_s_dim, __pyx_k_dim,
sizeof(__pyx_k_dim), 0, 0, 1, 1},
21701 {&__pyx_n_s_doc, __pyx_k_doc,
sizeof(__pyx_k_doc), 0, 0, 1, 1},
21702 {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object,
sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1},
21703 {&__pyx_n_s_encode, __pyx_k_encode,
sizeof(__pyx_k_encode), 0, 0, 1, 1},
21704 {&__pyx_n_s_enter, __pyx_k_enter,
sizeof(__pyx_k_enter), 0, 0, 1, 1},
21705 {&__pyx_n_s_enumerate, __pyx_k_enumerate,
sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
21706 {&__pyx_n_s_error, __pyx_k_error,
sizeof(__pyx_k_error), 0, 0, 1, 1},
21707 {&__pyx_n_s_exit, __pyx_k_exit,
sizeof(__pyx_k_exit), 0, 0, 1, 1},
21708 {&__pyx_n_s_filename, __pyx_k_filename,
sizeof(__pyx_k_filename), 0, 0, 1, 1},
21709 {&__pyx_n_s_flags, __pyx_k_flags,
sizeof(__pyx_k_flags), 0, 0, 1, 1},
21710 {&__pyx_n_s_format, __pyx_k_format,
sizeof(__pyx_k_format), 0, 0, 1, 1},
21711 {&__pyx_n_s_fortran, __pyx_k_fortran,
sizeof(__pyx_k_fortran), 0, 0, 1, 1},
21712 {&__pyx_n_u_fortran, __pyx_k_fortran,
sizeof(__pyx_k_fortran), 0, 1, 0, 1},
21713 {&__pyx_n_s_fwrite, __pyx_k_fwrite,
sizeof(__pyx_k_fwrite), 0, 0, 1, 1},
21714 {&__pyx_n_s_getCSRrepresentation, __pyx_k_getCSRrepresentation,
sizeof(__pyx_k_getCSRrepresentation), 0, 0, 1, 1},
21715 {&__pyx_n_s_getSubMatCSRrepresentation, __pyx_k_getSubMatCSRrepresentation,
sizeof(__pyx_k_getSubMatCSRrepresentation), 0, 0, 1, 1},
21716 {&__pyx_n_s_getstate, __pyx_k_getstate,
sizeof(__pyx_k_getstate), 0, 0, 1, 1},
21717 {&__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi,
sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 0, 1, 0},
21718 {&__pyx_n_s_i, __pyx_k_i,
sizeof(__pyx_k_i), 0, 0, 1, 1},
21719 {&__pyx_kp_s_i_i_i, __pyx_k_i_i_i,
sizeof(__pyx_k_i_i_i), 0, 0, 1, 0},
21720 {&__pyx_n_s_id, __pyx_k_id,
sizeof(__pyx_k_id), 0, 0, 1, 1},
21721 {&__pyx_n_s_import, __pyx_k_import,
sizeof(__pyx_k_import), 0, 0, 1, 1},
21722 {&__pyx_n_s_init, __pyx_k_init,
sizeof(__pyx_k_init), 0, 0, 1, 1},
21723 {&__pyx_n_s_itemsize, __pyx_k_itemsize,
sizeof(__pyx_k_itemsize), 0, 0, 1, 1},
21724 {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array,
sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0},
21725 {&__pyx_n_s_k, __pyx_k_k,
sizeof(__pyx_k_k), 0, 0, 1, 1},
21726 {&__pyx_n_s_main, __pyx_k_main,
sizeof(__pyx_k_main), 0, 0, 1, 1},
21727 {&__pyx_n_s_matvec, __pyx_k_matvec,
sizeof(__pyx_k_matvec), 0, 0, 1, 1},
21728 {&__pyx_n_s_memview, __pyx_k_memview,
sizeof(__pyx_k_memview), 0, 0, 1, 1},
21729 {&__pyx_n_s_metaclass, __pyx_k_metaclass,
sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
21730 {&__pyx_n_s_mode, __pyx_k_mode,
sizeof(__pyx_k_mode), 0, 0, 1, 1},
21731 {&__pyx_n_s_module, __pyx_k_module,
sizeof(__pyx_k_module), 0, 0, 1, 1},
21732 {&__pyx_n_s_name, __pyx_k_name,
sizeof(__pyx_k_name), 0, 0, 1, 1},
21733 {&__pyx_n_s_name_2, __pyx_k_name_2,
sizeof(__pyx_k_name_2), 0, 0, 1, 1},
21734 {&__pyx_n_s_nc, __pyx_k_nc,
sizeof(__pyx_k_nc), 0, 0, 1, 1},
21735 {&__pyx_n_s_ndim, __pyx_k_ndim,
sizeof(__pyx_k_ndim), 0, 0, 1, 1},
21736 {&__pyx_n_s_new, __pyx_k_new,
sizeof(__pyx_k_new), 0, 0, 1, 1},
21737 {&__pyx_n_s_nnz, __pyx_k_nnz,
sizeof(__pyx_k_nnz), 0, 0, 1, 1},
21738 {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non,
sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0},
21739 {&__pyx_n_s_np, __pyx_k_np,
sizeof(__pyx_k_np), 0, 0, 1, 1},
21740 {&__pyx_n_s_nr, __pyx_k_nr,
sizeof(__pyx_k_nr), 0, 0, 1, 1},
21741 {&__pyx_n_s_numpy, __pyx_k_numpy,
sizeof(__pyx_k_numpy), 0, 0, 1, 1},
21742 {&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to,
sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0},
21743 {&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor,
sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0},
21744 {&__pyx_n_s_nzval, __pyx_k_nzval,
sizeof(__pyx_k_nzval), 0, 0, 1, 1},
21745 {&__pyx_n_s_nzvals, __pyx_k_nzvals,
sizeof(__pyx_k_nzvals), 0, 0, 1, 1},
21746 {&__pyx_n_s_obj, __pyx_k_obj,
sizeof(__pyx_k_obj), 0, 0, 1, 1},
21747 {&__pyx_n_s_object, __pyx_k_object,
sizeof(__pyx_k_object), 0, 0, 1, 1},
21748 {&__pyx_n_s_open, __pyx_k_open,
sizeof(__pyx_k_open), 0, 0, 1, 1},
21749 {&__pyx_n_s_output_file, __pyx_k_output_file,
sizeof(__pyx_k_output_file), 0, 0, 1, 1},
21750 {&__pyx_n_s_pack, __pyx_k_pack,
sizeof(__pyx_k_pack), 0, 0, 1, 1},
21751 {&__pyx_n_s_pickle, __pyx_k_pickle,
sizeof(__pyx_k_pickle), 0, 0, 1, 1},
21752 {&__pyx_n_s_prepare, __pyx_k_prepare,
sizeof(__pyx_k_prepare), 0, 0, 1, 1},
21753 {&__pyx_kp_s_proteus_superluWrappers_pyx, __pyx_k_proteus_superluWrappers_pyx,
sizeof(__pyx_k_proteus_superluWrappers_pyx), 0, 0, 1, 0},
21754 {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError,
sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
21755 {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum,
sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
21756 {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer,
sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1},
21757 {&__pyx_n_s_pyx_result, __pyx_k_pyx_result,
sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
21758 {&__pyx_n_s_pyx_state, __pyx_k_pyx_state,
sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
21759 {&__pyx_n_s_pyx_type, __pyx_k_pyx_type,
sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
21760 {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum,
sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1},
21761 {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable,
sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
21762 {&__pyx_n_s_qualname, __pyx_k_qualname,
sizeof(__pyx_k_qualname), 0, 0, 1, 1},
21763 {&__pyx_n_s_range, __pyx_k_range,
sizeof(__pyx_k_range), 0, 0, 1, 1},
21764 {&__pyx_n_s_range_end, __pyx_k_range_end,
sizeof(__pyx_k_range_end), 0, 0, 1, 1},
21765 {&__pyx_n_s_range_start, __pyx_k_range_start,
sizeof(__pyx_k_range_start), 0, 0, 1, 1},
21766 {&__pyx_n_s_reduce, __pyx_k_reduce,
sizeof(__pyx_k_reduce), 0, 0, 1, 1},
21767 {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython,
sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
21768 {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex,
sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
21769 {&__pyx_n_s_rowptr, __pyx_k_rowptr,
sizeof(__pyx_k_rowptr), 0, 0, 1, 1},
21770 {&__pyx_n_s_rows, __pyx_k_rows,
sizeof(__pyx_k_rows), 0, 0, 1, 1},
21771 {&__pyx_n_s_self, __pyx_k_self,
sizeof(__pyx_k_self), 0, 0, 1, 1},
21772 {&__pyx_kp_s_self_A_self_AC_self_L_self_U_sel, __pyx_k_self_A_self_AC_self_L_self_U_sel,
sizeof(__pyx_k_self_A_self_AC_self_L_self_U_sel), 0, 0, 1, 0},
21773 {&__pyx_n_s_setstate, __pyx_k_setstate,
sizeof(__pyx_k_setstate), 0, 0, 1, 1},
21774 {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython,
sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
21775 {&__pyx_n_s_shape, __pyx_k_shape,
sizeof(__pyx_k_shape), 0, 0, 1, 1},
21776 {&__pyx_n_s_size, __pyx_k_size,
sizeof(__pyx_k_size), 0, 0, 1, 1},
21777 {&__pyx_n_s_sparseFactor, __pyx_k_sparseFactor,
sizeof(__pyx_k_sparseFactor), 0, 0, 1, 1},
21778 {&__pyx_n_s_sparseFactorPrepare, __pyx_k_sparseFactorPrepare,
sizeof(__pyx_k_sparseFactorPrepare), 0, 0, 1, 1},
21779 {&__pyx_n_s_sparseFactorSolve, __pyx_k_sparseFactorSolve,
sizeof(__pyx_k_sparseFactorSolve), 0, 0, 1, 1},
21780 {&__pyx_n_s_sparse_matrix, __pyx_k_sparse_matrix,
sizeof(__pyx_k_sparse_matrix), 0, 0, 1, 1},
21781 {&__pyx_n_s_start, __pyx_k_start,
sizeof(__pyx_k_start), 0, 0, 1, 1},
21782 {&__pyx_n_s_step, __pyx_k_step,
sizeof(__pyx_k_step), 0, 0, 1, 1},
21783 {&__pyx_n_s_stop, __pyx_k_stop,
sizeof(__pyx_k_stop), 0, 0, 1, 1},
21784 {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct,
sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0},
21785 {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect,
sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0},
21786 {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect,
sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0},
21787 {&__pyx_kp_s_stringsource, __pyx_k_stringsource,
sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
21788 {&__pyx_n_s_struct, __pyx_k_struct,
sizeof(__pyx_k_struct), 0, 0, 1, 1},
21789 {&__pyx_n_s_superluWrappers, __pyx_k_superluWrappers,
sizeof(__pyx_k_superluWrappers), 0, 0, 1, 1},
21790 {&__pyx_n_s_test, __pyx_k_test,
sizeof(__pyx_k_test), 0, 0, 1, 1},
21791 {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data,
sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0},
21792 {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str,
sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0},
21793 {&__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_k_unknown_dtype_code_in_numpy_pxd,
sizeof(__pyx_k_unknown_dtype_code_in_numpy_pxd), 0, 1, 0, 0},
21794 {&__pyx_n_s_unpack, __pyx_k_unpack,
sizeof(__pyx_k_unpack), 0, 0, 1, 1},
21795 {&__pyx_n_s_update, __pyx_k_update,
sizeof(__pyx_k_update), 0, 0, 1, 1},
21796 {&__pyx_n_s_w, __pyx_k_w,
sizeof(__pyx_k_w), 0, 0, 1, 1},
21797 {&__pyx_n_s_write, __pyx_k_write,
sizeof(__pyx_k_write), 0, 0, 1, 1},
21798 {&__pyx_n_s_x, __pyx_k_x,
sizeof(__pyx_k_x), 0, 0, 1, 1},
21799 {&__pyx_n_s_y, __pyx_k_y,
sizeof(__pyx_k_y), 0, 0, 1, 1},
21800 {0, 0, 0, 0, 0, 0, 0}
21802 static CYTHON_SMALL_CODE
int __Pyx_InitCachedBuiltins(
void) {
21803 __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object);
if (!__pyx_builtin_object) __PYX_ERR(0, 13, __pyx_L1_error)
21804 __pyx_builtin_open = __Pyx_GetBuiltinName(__pyx_n_s_open);
if (!__pyx_builtin_open) __PYX_ERR(0, 56, __pyx_L1_error)
21805 __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range);
if (!__pyx_builtin_range) __PYX_ERR(0, 58, __pyx_L1_error)
21806 __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError);
if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error)
21807 __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError);
if (!__pyx_builtin_RuntimeError) __PYX_ERR(2, 777, __pyx_L1_error)
21808 __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError);
if (!__pyx_builtin_ValueError) __PYX_ERR(2, 781, __pyx_L1_error)
21809 __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError);
if (!__pyx_builtin_ImportError) __PYX_ERR(2, 959, __pyx_L1_error)
21810 __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError);
if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 148, __pyx_L1_error)
21811 __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate);
if (!__pyx_builtin_enumerate) __PYX_ERR(1, 151, __pyx_L1_error)
21812 __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis);
if (!__pyx_builtin_Ellipsis) __PYX_ERR(1, 404, __pyx_L1_error)
21813 __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id);
if (!__pyx_builtin_id) __PYX_ERR(1, 613, __pyx_L1_error)
21814 __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError);
if (!__pyx_builtin_IndexError) __PYX_ERR(1, 832, __pyx_L1_error)
21820 static CYTHON_SMALL_CODE
int __Pyx_InitCachedConstants(
void) {
21821 __Pyx_RefNannyDeclarations
21822 __Pyx_RefNannySetupContext(
"__Pyx_InitCachedConstants", 0);
21831 __pyx_tuple_ = PyTuple_Pack(3, Py_None, Py_None, Py_None);
if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 56, __pyx_L1_error)
21832 __Pyx_GOTREF(__pyx_tuple_);
21833 __Pyx_GIVEREF(__pyx_tuple_);
21841 __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 2, __pyx_L1_error)
21842 __Pyx_GOTREF(__pyx_tuple__2);
21843 __Pyx_GIVEREF(__pyx_tuple__2);
21850 __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 4, __pyx_L1_error)
21851 __Pyx_GOTREF(__pyx_tuple__3);
21852 __Pyx_GIVEREF(__pyx_tuple__3);
21860 __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_self_A_self_AC_self_L_self_U_sel);
if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 2, __pyx_L1_error)
21861 __Pyx_GOTREF(__pyx_tuple__4);
21862 __Pyx_GIVEREF(__pyx_tuple__4);
21869 __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_self_A_self_AC_self_L_self_U_sel);
if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 4, __pyx_L1_error)
21870 __Pyx_GOTREF(__pyx_tuple__5);
21871 __Pyx_GIVEREF(__pyx_tuple__5);
21880 __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor);
if (unlikely(!__pyx_tuple__6)) __PYX_ERR(2, 777, __pyx_L1_error)
21881 __Pyx_GOTREF(__pyx_tuple__6);
21882 __Pyx_GIVEREF(__pyx_tuple__6);
21891 __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor);
if (unlikely(!__pyx_tuple__7)) __PYX_ERR(2, 781, __pyx_L1_error)
21892 __Pyx_GOTREF(__pyx_tuple__7);
21893 __Pyx_GIVEREF(__pyx_tuple__7);
21902 __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2);
if (unlikely(!__pyx_tuple__8)) __PYX_ERR(2, 801, __pyx_L1_error)
21903 __Pyx_GOTREF(__pyx_tuple__8);
21904 __Pyx_GIVEREF(__pyx_tuple__8);
21913 __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to);
if (unlikely(!__pyx_tuple__9)) __PYX_ERR(2, 959, __pyx_L1_error)
21914 __Pyx_GOTREF(__pyx_tuple__9);
21915 __Pyx_GIVEREF(__pyx_tuple__9);
21924 __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor);
if (unlikely(!__pyx_tuple__10)) __PYX_ERR(2, 965, __pyx_L1_error)
21925 __Pyx_GOTREF(__pyx_tuple__10);
21926 __Pyx_GIVEREF(__pyx_tuple__10);
21935 __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr);
if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 133, __pyx_L1_error)
21936 __Pyx_GOTREF(__pyx_tuple__11);
21937 __Pyx_GIVEREF(__pyx_tuple__11);
21946 __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array);
if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 136, __pyx_L1_error)
21947 __Pyx_GOTREF(__pyx_tuple__12);
21948 __Pyx_GIVEREF(__pyx_tuple__12);
21957 __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str);
if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 148, __pyx_L1_error)
21958 __Pyx_GOTREF(__pyx_tuple__13);
21959 __Pyx_GIVEREF(__pyx_tuple__13);
21968 __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data);
if (unlikely(!__pyx_tuple__14)) __PYX_ERR(1, 176, __pyx_L1_error)
21969 __Pyx_GOTREF(__pyx_tuple__14);
21970 __Pyx_GIVEREF(__pyx_tuple__14);
21979 __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is);
if (unlikely(!__pyx_tuple__15)) __PYX_ERR(1, 192, __pyx_L1_error)
21980 __Pyx_GOTREF(__pyx_tuple__15);
21981 __Pyx_GIVEREF(__pyx_tuple__15);
21989 __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__16)) __PYX_ERR(1, 2, __pyx_L1_error)
21990 __Pyx_GOTREF(__pyx_tuple__16);
21991 __Pyx_GIVEREF(__pyx_tuple__16);
21998 __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__17)) __PYX_ERR(1, 4, __pyx_L1_error)
21999 __Pyx_GOTREF(__pyx_tuple__17);
22000 __Pyx_GIVEREF(__pyx_tuple__17);
22009 __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor);
if (unlikely(!__pyx_tuple__18)) __PYX_ERR(1, 418, __pyx_L1_error)
22010 __Pyx_GOTREF(__pyx_tuple__18);
22011 __Pyx_GIVEREF(__pyx_tuple__18);
22020 __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object);
if (unlikely(!__pyx_tuple__19)) __PYX_ERR(1, 495, __pyx_L1_error)
22021 __Pyx_GOTREF(__pyx_tuple__19);
22022 __Pyx_GIVEREF(__pyx_tuple__19);
22031 __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi);
if (unlikely(!__pyx_tuple__20)) __PYX_ERR(1, 520, __pyx_L1_error)
22032 __Pyx_GOTREF(__pyx_tuple__20);
22033 __Pyx_GIVEREF(__pyx_tuple__20);
22042 __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri);
if (unlikely(!__pyx_tuple__21)) __PYX_ERR(1, 570, __pyx_L1_error)
22043 __Pyx_GOTREF(__pyx_tuple__21);
22044 __Pyx_GIVEREF(__pyx_tuple__21);
22053 __pyx_tuple__22 = PyTuple_New(1);
if (unlikely(!__pyx_tuple__22)) __PYX_ERR(1, 577, __pyx_L1_error)
22054 __Pyx_GOTREF(__pyx_tuple__22);
22055 __Pyx_INCREF(__pyx_int_neg_1);
22056 __Pyx_GIVEREF(__pyx_int_neg_1);
22057 PyTuple_SET_ITEM(__pyx_tuple__22, 0, __pyx_int_neg_1);
22058 __Pyx_GIVEREF(__pyx_tuple__22);
22066 __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__23)) __PYX_ERR(1, 2, __pyx_L1_error)
22067 __Pyx_GOTREF(__pyx_tuple__23);
22068 __Pyx_GIVEREF(__pyx_tuple__23);
22075 __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__24)) __PYX_ERR(1, 4, __pyx_L1_error)
22076 __Pyx_GOTREF(__pyx_tuple__24);
22077 __Pyx_GIVEREF(__pyx_tuple__24);
22086 __pyx_slice__25 = PySlice_New(Py_None, Py_None, Py_None);
if (unlikely(!__pyx_slice__25)) __PYX_ERR(1, 682, __pyx_L1_error)
22087 __Pyx_GOTREF(__pyx_slice__25);
22088 __Pyx_GIVEREF(__pyx_slice__25);
22097 __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte);
if (unlikely(!__pyx_tuple__26)) __PYX_ERR(1, 703, __pyx_L1_error)
22098 __Pyx_GOTREF(__pyx_tuple__26);
22099 __Pyx_GIVEREF(__pyx_tuple__26);
22107 __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__27)) __PYX_ERR(1, 2, __pyx_L1_error)
22108 __Pyx_GOTREF(__pyx_tuple__27);
22109 __Pyx_GIVEREF(__pyx_tuple__27);
22116 __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__28)) __PYX_ERR(1, 4, __pyx_L1_error)
22117 __Pyx_GOTREF(__pyx_tuple__28);
22118 __Pyx_GIVEREF(__pyx_tuple__28);
22127 __pyx_tuple__29 = PyTuple_Pack(1, __pyx_builtin_object);
if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 13, __pyx_L1_error)
22128 __Pyx_GOTREF(__pyx_tuple__29);
22129 __Pyx_GIVEREF(__pyx_tuple__29);
22138 __pyx_tuple__30 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_nr, __pyx_n_s_nc, __pyx_n_s_nnz, __pyx_n_s_nzvals, __pyx_n_s_colind, __pyx_n_s_rowptr);
if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 15, __pyx_L1_error)
22139 __Pyx_GOTREF(__pyx_tuple__30);
22140 __Pyx_GIVEREF(__pyx_tuple__30);
22141 __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(7, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_superluWrappers_pyx, __pyx_n_s_init, 15, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 15, __pyx_L1_error)
22150 __pyx_tuple__32 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_x, __pyx_n_s_y);
if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 35, __pyx_L1_error)
22151 __Pyx_GOTREF(__pyx_tuple__32);
22152 __Pyx_GIVEREF(__pyx_tuple__32);
22153 __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_superluWrappers_pyx, __pyx_n_s_matvec, 35, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 35, __pyx_L1_error)
22162 __pyx_tuple__34 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_filename, __pyx_n_s_base, __pyx_n_s_output_file, __pyx_n_s_i, __pyx_n_s_k);
if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 46, __pyx_L1_error)
22163 __Pyx_GOTREF(__pyx_tuple__34);
22164 __Pyx_GIVEREF(__pyx_tuple__34);
22165 __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_superluWrappers_pyx, __pyx_n_s_fwrite, 46, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 46, __pyx_L1_error)
22174 __pyx_tuple__36 = PyTuple_Pack(1, __pyx_n_s_self);
if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 62, __pyx_L1_error)
22175 __Pyx_GOTREF(__pyx_tuple__36);
22176 __Pyx_GIVEREF(__pyx_tuple__36);
22177 __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_superluWrappers_pyx, __pyx_n_s_getCSRrepresentation, 62, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 62, __pyx_L1_error)
22186 __pyx_tuple__38 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_range_start, __pyx_n_s_range_end, __pyx_n_s_rows, __pyx_n_s_nnz, __pyx_n_s_rowptr, __pyx_n_s_colind, __pyx_n_s_nzvals);
if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 72, __pyx_L1_error)
22187 __Pyx_GOTREF(__pyx_tuple__38);
22188 __Pyx_GIVEREF(__pyx_tuple__38);
22189 __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(3, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_superluWrappers_pyx, __pyx_n_s_getSubMatCSRrepresentation, 72, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 72, __pyx_L1_error)
22198 __pyx_tuple__40 = PyTuple_Pack(2, __pyx_n_s_sparse_matrix, __pyx_n_s_sparseFactor);
if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 219, __pyx_L1_error)
22199 __Pyx_GOTREF(__pyx_tuple__40);
22200 __Pyx_GIVEREF(__pyx_tuple__40);
22201 __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_superluWrappers_pyx, __pyx_n_s_sparseFactorPrepare, 219, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 219, __pyx_L1_error)
22210 __pyx_tuple__42 = PyTuple_Pack(2, __pyx_n_s_sparseFactor, __pyx_n_s_x);
if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 286, __pyx_L1_error)
22211 __Pyx_GOTREF(__pyx_tuple__42);
22212 __Pyx_GIVEREF(__pyx_tuple__42);
22213 __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_superluWrappers_pyx, __pyx_n_s_sparseFactorSolve, 286, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 286, __pyx_L1_error)
22222 __pyx_tuple__44 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect);
if (unlikely(!__pyx_tuple__44)) __PYX_ERR(1, 286, __pyx_L1_error)
22223 __Pyx_GOTREF(__pyx_tuple__44);
22224 __Pyx_GIVEREF(__pyx_tuple__44);
22233 __pyx_tuple__45 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct);
if (unlikely(!__pyx_tuple__45)) __PYX_ERR(1, 287, __pyx_L1_error)
22234 __Pyx_GOTREF(__pyx_tuple__45);
22235 __Pyx_GIVEREF(__pyx_tuple__45);
22244 __pyx_tuple__46 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect);
if (unlikely(!__pyx_tuple__46)) __PYX_ERR(1, 288, __pyx_L1_error)
22245 __Pyx_GOTREF(__pyx_tuple__46);
22246 __Pyx_GIVEREF(__pyx_tuple__46);
22255 __pyx_tuple__47 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct);
if (unlikely(!__pyx_tuple__47)) __PYX_ERR(1, 291, __pyx_L1_error)
22256 __Pyx_GOTREF(__pyx_tuple__47);
22257 __Pyx_GIVEREF(__pyx_tuple__47);
22266 __pyx_tuple__48 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect);
if (unlikely(!__pyx_tuple__48)) __PYX_ERR(1, 292, __pyx_L1_error)
22267 __Pyx_GOTREF(__pyx_tuple__48);
22268 __Pyx_GIVEREF(__pyx_tuple__48);
22275 __pyx_tuple__49 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result);
if (unlikely(!__pyx_tuple__49)) __PYX_ERR(1, 1, __pyx_L1_error)
22276 __Pyx_GOTREF(__pyx_tuple__49);
22277 __Pyx_GIVEREF(__pyx_tuple__49);
22278 __pyx_codeobj__50 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__49, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__50)) __PYX_ERR(1, 1, __pyx_L1_error)
22279 __Pyx_RefNannyFinishContext();
22282 __Pyx_RefNannyFinishContext();
22286 static CYTHON_SMALL_CODE
int __Pyx_InitGlobals(
void) {
22287 if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
22288 __pyx_int_0 = PyInt_FromLong(0);
if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
22289 __pyx_int_1 = PyInt_FromLong(1);
if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
22290 __pyx_int_184977713 = PyInt_FromLong(184977713
L);
if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error)
22291 __pyx_int_neg_1 = PyInt_FromLong(-1);
if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
22297 static CYTHON_SMALL_CODE
int __Pyx_modinit_global_init_code(
void);
22298 static CYTHON_SMALL_CODE
int __Pyx_modinit_variable_export_code(
void);
22299 static CYTHON_SMALL_CODE
int __Pyx_modinit_function_export_code(
void);
22300 static CYTHON_SMALL_CODE
int __Pyx_modinit_type_init_code(
void);
22301 static CYTHON_SMALL_CODE
int __Pyx_modinit_type_import_code(
void);
22302 static CYTHON_SMALL_CODE
int __Pyx_modinit_variable_import_code(
void);
22303 static CYTHON_SMALL_CODE
int __Pyx_modinit_function_import_code(
void);
22305 static int __Pyx_modinit_global_init_code(
void) {
22306 __Pyx_RefNannyDeclarations
22307 __Pyx_RefNannySetupContext(
"__Pyx_modinit_global_init_code", 0);
22309 generic = Py_None; Py_INCREF(Py_None);
22310 strided = Py_None; Py_INCREF(Py_None);
22311 indirect = Py_None; Py_INCREF(Py_None);
22312 contiguous = Py_None; Py_INCREF(Py_None);
22313 indirect_contiguous = Py_None; Py_INCREF(Py_None);
22314 __Pyx_RefNannyFinishContext();
22318 static int __Pyx_modinit_variable_export_code(
void) {
22319 __Pyx_RefNannyDeclarations
22320 __Pyx_RefNannySetupContext(
"__Pyx_modinit_variable_export_code", 0);
22322 __Pyx_RefNannyFinishContext();
22326 static int __Pyx_modinit_function_export_code(
void) {
22327 __Pyx_RefNannyDeclarations
22328 __Pyx_RefNannySetupContext(
"__Pyx_modinit_function_export_code", 0);
22330 __Pyx_RefNannyFinishContext();
22334 static int __Pyx_modinit_type_init_code(
void) {
22335 __Pyx_RefNannyDeclarations
22336 int __pyx_lineno = 0;
22337 const char *__pyx_filename = NULL;
22338 int __pyx_clineno = 0;
22339 __Pyx_RefNannySetupContext(
"__Pyx_modinit_type_init_code", 0);
22341 if (PyType_Ready(&__pyx_type_15superluWrappers_cSparseMatrix) < 0) __PYX_ERR(0, 100, __pyx_L1_error)
22342 #if PY_VERSION_HEX < 0x030800B1
22343 __pyx_type_15superluWrappers_cSparseMatrix.tp_print = 0;
22345 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_15superluWrappers_cSparseMatrix.tp_dictoffset && __pyx_type_15superluWrappers_cSparseMatrix.tp_getattro == PyObject_GenericGetAttr)) {
22346 __pyx_type_15superluWrappers_cSparseMatrix.tp_getattro = __Pyx_PyObject_GenericGetAttr;
22348 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_cSparseMatrix_2, (PyObject *)&__pyx_type_15superluWrappers_cSparseMatrix) < 0) __PYX_ERR(0, 100, __pyx_L1_error)
22349 if (__Pyx_setup_reduce((PyObject*)&__pyx_type_15superluWrappers_cSparseMatrix) < 0) __PYX_ERR(0, 100, __pyx_L1_error)
22350 __pyx_ptype_15superluWrappers_cSparseMatrix = &__pyx_type_15superluWrappers_cSparseMatrix;
22351 __pyx_vtabptr_15superluWrappers_SparseFactor = &__pyx_vtable_15superluWrappers_SparseFactor;
22352 __pyx_vtable_15superluWrappers_SparseFactor._set_mat_types = (PyObject *(*)(
struct __pyx_obj_15superluWrappers_SparseFactor *))__pyx_f_15superluWrappers_12SparseFactor__set_mat_types;
22353 if (PyType_Ready(&__pyx_type_15superluWrappers_SparseFactor) < 0) __PYX_ERR(0, 145, __pyx_L1_error)
22354 #if PY_VERSION_HEX < 0x030800B1
22355 __pyx_type_15superluWrappers_SparseFactor.tp_print = 0;
22357 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_15superluWrappers_SparseFactor.tp_dictoffset && __pyx_type_15superluWrappers_SparseFactor.tp_getattro == PyObject_GenericGetAttr)) {
22358 __pyx_type_15superluWrappers_SparseFactor.tp_getattro = __Pyx_PyObject_GenericGetAttr;
22360 #if CYTHON_COMPILING_IN_CPYTHON
22362 PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_15superluWrappers_SparseFactor,
"__init__");
if (unlikely(!wrapper)) __PYX_ERR(0, 145, __pyx_L1_error)
22363 if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
22364 __pyx_wrapperbase_15superluWrappers_12SparseFactor___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
22365 __pyx_wrapperbase_15superluWrappers_12SparseFactor___init__.doc = __pyx_doc_15superluWrappers_12SparseFactor___init__;
22366 ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_15superluWrappers_12SparseFactor___init__;
22370 if (__Pyx_SetVtable(__pyx_type_15superluWrappers_SparseFactor.tp_dict, __pyx_vtabptr_15superluWrappers_SparseFactor) < 0) __PYX_ERR(0, 145, __pyx_L1_error)
22371 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SparseFactor, (PyObject *)&__pyx_type_15superluWrappers_SparseFactor) < 0) __PYX_ERR(0, 145, __pyx_L1_error)
22372 if (__Pyx_setup_reduce((PyObject*)&__pyx_type_15superluWrappers_SparseFactor) < 0) __PYX_ERR(0, 145, __pyx_L1_error)
22373 __pyx_ptype_15superluWrappers_SparseFactor = &__pyx_type_15superluWrappers_SparseFactor;
22374 __pyx_vtabptr_array = &__pyx_vtable_array;
22375 __pyx_vtable_array.get_memview = (PyObject *(*)(
struct __pyx_array_obj *))__pyx_array_get_memview;
22376 if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(1, 105, __pyx_L1_error)
22377 #if PY_VERSION_HEX < 0x030800B1
22378 __pyx_type___pyx_array.tp_print = 0;
22380 if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(1, 105, __pyx_L1_error)
22381 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(1, 105, __pyx_L1_error)
22382 __pyx_array_type = &__pyx_type___pyx_array;
22383 if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(1, 279, __pyx_L1_error)
22384 #if PY_VERSION_HEX < 0x030800B1
22385 __pyx_type___pyx_MemviewEnum.tp_print = 0;
22387 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_MemviewEnum.tp_dictoffset && __pyx_type___pyx_MemviewEnum.tp_getattro == PyObject_GenericGetAttr)) {
22388 __pyx_type___pyx_MemviewEnum.tp_getattro = __Pyx_PyObject_GenericGetAttr;
22390 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(1, 279, __pyx_L1_error)
22391 __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
22392 __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
22393 __pyx_vtable_memoryview.get_item_pointer = (
char *(*)(
struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
22394 __pyx_vtable_memoryview.is_slice = (PyObject *(*)(
struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
22395 __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(
struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment;
22396 __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(
struct __pyx_memoryview_obj *,
struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar;
22397 __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(
struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed;
22398 __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(
struct __pyx_memoryview_obj *,
char *))__pyx_memoryview_convert_item_to_object;
22399 __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(
struct __pyx_memoryview_obj *,
char *, PyObject *))__pyx_memoryview_assign_item_from_object;
22400 if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(1, 330, __pyx_L1_error)
22401 #if PY_VERSION_HEX < 0x030800B1
22402 __pyx_type___pyx_memoryview.tp_print = 0;
22404 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryview.tp_dictoffset && __pyx_type___pyx_memoryview.tp_getattro == PyObject_GenericGetAttr)) {
22405 __pyx_type___pyx_memoryview.tp_getattro = __Pyx_PyObject_GenericGetAttr;
22407 if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(1, 330, __pyx_L1_error)
22408 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(1, 330, __pyx_L1_error)
22409 __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
22410 __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
22411 __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
22412 __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(
struct __pyx_memoryview_obj *,
char *))__pyx_memoryviewslice_convert_item_to_object;
22413 __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(
struct __pyx_memoryview_obj *,
char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object;
22414 __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
22415 if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(1, 965, __pyx_L1_error)
22416 #if PY_VERSION_HEX < 0x030800B1
22417 __pyx_type___pyx_memoryviewslice.tp_print = 0;
22419 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryviewslice.tp_dictoffset && __pyx_type___pyx_memoryviewslice.tp_getattro == PyObject_GenericGetAttr)) {
22420 __pyx_type___pyx_memoryviewslice.tp_getattro = __Pyx_PyObject_GenericGetAttr;
22422 if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(1, 965, __pyx_L1_error)
22423 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(1, 965, __pyx_L1_error)
22424 __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
22425 __Pyx_RefNannyFinishContext();
22428 __Pyx_RefNannyFinishContext();
22432 static int __Pyx_modinit_type_import_code(
void) {
22433 __Pyx_RefNannyDeclarations
22434 PyObject *__pyx_t_1 = NULL;
22435 int __pyx_lineno = 0;
22436 const char *__pyx_filename = NULL;
22437 int __pyx_clineno = 0;
22438 __Pyx_RefNannySetupContext(
"__Pyx_modinit_type_import_code", 0);
22440 __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME);
if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error)
22441 __Pyx_GOTREF(__pyx_t_1);
22442 __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME,
"type",
22443 #
if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
22444 sizeof(PyTypeObject),
22446 sizeof(PyHeapTypeObject),
22448 __Pyx_ImportType_CheckSize_Warn);
22449 if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error)
22450 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22451 __pyx_t_1 = PyImport_ImportModule(
"numpy");
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 207, __pyx_L1_error)
22452 __Pyx_GOTREF(__pyx_t_1);
22453 __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1,
"numpy",
"dtype",
sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
22454 if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(2, 207, __pyx_L1_error)
22455 __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1,
"numpy",
"flatiter",
sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Ignore);
22456 if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(2, 230, __pyx_L1_error)
22457 __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1,
"numpy",
"broadcast",
sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Ignore);
22458 if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(2, 234, __pyx_L1_error)
22459 __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1,
"numpy",
"ndarray",
sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
22460 if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(2, 246, __pyx_L1_error)
22461 __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1,
"numpy",
"ufunc",
sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Ignore);
22462 if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(2, 839, __pyx_L1_error)
22463 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22464 __Pyx_RefNannyFinishContext();
22467 __Pyx_XDECREF(__pyx_t_1);
22468 __Pyx_RefNannyFinishContext();
22472 static int __Pyx_modinit_variable_import_code(
void) {
22473 __Pyx_RefNannyDeclarations
22474 __Pyx_RefNannySetupContext(
"__Pyx_modinit_variable_import_code", 0);
22476 __Pyx_RefNannyFinishContext();
22480 static int __Pyx_modinit_function_import_code(
void) {
22481 __Pyx_RefNannyDeclarations
22482 __Pyx_RefNannySetupContext(
"__Pyx_modinit_function_import_code", 0);
22484 __Pyx_RefNannyFinishContext();
22489 #ifndef CYTHON_NO_PYINIT_EXPORT
22490 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
22491 #elif PY_MAJOR_VERSION < 3
22493 #define __Pyx_PyMODINIT_FUNC extern "C" void
22495 #define __Pyx_PyMODINIT_FUNC void
22499 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
22501 #define __Pyx_PyMODINIT_FUNC PyObject *
22506 #if PY_MAJOR_VERSION < 3
22507 __Pyx_PyMODINIT_FUNC initsuperluWrappers(
void) CYTHON_SMALL_CODE;
22508 __Pyx_PyMODINIT_FUNC initsuperluWrappers(
void)
22510 __Pyx_PyMODINIT_FUNC PyInit_superluWrappers(
void) CYTHON_SMALL_CODE;
22511 __Pyx_PyMODINIT_FUNC PyInit_superluWrappers(
void)
22512 #if CYTHON_PEP489_MULTI_PHASE_INIT
22514 return PyModuleDef_Init(&__pyx_moduledef);
22516 static CYTHON_SMALL_CODE
int __Pyx_check_single_interpreter(
void) {
22517 #if PY_VERSION_HEX >= 0x030700A1
22518 static PY_INT64_T main_interpreter_id = -1;
22519 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
22520 if (main_interpreter_id == -1) {
22521 main_interpreter_id = current_id;
22522 return (unlikely(current_id == -1)) ? -1 : 0;
22523 }
else if (unlikely(main_interpreter_id != current_id))
22525 static PyInterpreterState *main_interpreter = NULL;
22526 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
22527 if (!main_interpreter) {
22528 main_interpreter = current_interpreter;
22529 }
else if (unlikely(main_interpreter != current_interpreter))
22534 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
22539 static CYTHON_SMALL_CODE
int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict,
const char* from_name,
const char* to_name,
int allow_none) {
22540 PyObject *value = PyObject_GetAttrString(spec, from_name);
22542 if (likely(value)) {
22543 if (allow_none || value != Py_None) {
22544 result = PyDict_SetItemString(moddict, to_name, value);
22547 }
else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
22554 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
22555 PyObject *module = NULL, *moddict, *modname;
22556 if (__Pyx_check_single_interpreter())
22559 return __Pyx_NewRef(__pyx_m);
22560 modname = PyObject_GetAttrString(spec,
"name");
22561 if (unlikely(!modname))
goto bad;
22562 module = PyModule_NewObject(modname);
22563 Py_DECREF(modname);
22564 if (unlikely(!module))
goto bad;
22565 moddict = PyModule_GetDict(module);
22566 if (unlikely(!moddict))
goto bad;
22567 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"loader",
"__loader__", 1) < 0))
goto bad;
22568 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"origin",
"__file__", 1) < 0))
goto bad;
22569 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"parent",
"__package__", 1) < 0))
goto bad;
22570 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"submodule_search_locations",
"__path__", 0) < 0))
goto bad;
22573 Py_XDECREF(module);
22578 static CYTHON_SMALL_CODE
int __pyx_pymod_exec_superluWrappers(PyObject *__pyx_pyinit_module)
22582 PyObject *__pyx_t_1 = NULL;
22583 PyObject *__pyx_t_2 = NULL;
22584 PyObject *__pyx_t_3 = NULL;
22585 static PyThread_type_lock __pyx_t_4[8];
22586 int __pyx_lineno = 0;
22587 const char *__pyx_filename = NULL;
22588 int __pyx_clineno = 0;
22589 __Pyx_RefNannyDeclarations
22590 #if CYTHON_PEP489_MULTI_PHASE_INIT
22592 if (__pyx_m == __pyx_pyinit_module)
return 0;
22593 PyErr_SetString(PyExc_RuntimeError,
"Module 'superluWrappers' has already been imported. Re-initialisation is not supported.");
22596 #elif PY_MAJOR_VERSION >= 3
22597 if (__pyx_m)
return __Pyx_NewRef(__pyx_m);
22599 #if CYTHON_REFNANNY
22600 __Pyx_RefNanny = __Pyx_RefNannyImportAPI(
"refnanny");
22601 if (!__Pyx_RefNanny) {
22603 __Pyx_RefNanny = __Pyx_RefNannyImportAPI(
"Cython.Runtime.refnanny");
22604 if (!__Pyx_RefNanny)
22605 Py_FatalError(
"failed to import 'refnanny' module");
22608 __Pyx_RefNannySetupContext(
"__Pyx_PyMODINIT_FUNC PyInit_superluWrappers(void)", 0);
22609 if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22610 #ifdef __Pxy_PyFrame_Initialize_Offsets
22611 __Pxy_PyFrame_Initialize_Offsets();
22613 __pyx_empty_tuple = PyTuple_New(0);
if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
22614 __pyx_empty_bytes = PyBytes_FromStringAndSize(
"", 0);
if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
22615 __pyx_empty_unicode = PyUnicode_FromStringAndSize(
"", 0);
if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
22616 #ifdef __Pyx_CyFunction_USED
22617 if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22619 #ifdef __Pyx_FusedFunction_USED
22620 if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22622 #ifdef __Pyx_Coroutine_USED
22623 if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22625 #ifdef __Pyx_Generator_USED
22626 if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22628 #ifdef __Pyx_AsyncGen_USED
22629 if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22631 #ifdef __Pyx_StopAsyncIteration_USED
22632 if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22636 #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
22638 PyEval_InitThreads();
22642 #if CYTHON_PEP489_MULTI_PHASE_INIT
22643 __pyx_m = __pyx_pyinit_module;
22644 Py_INCREF(__pyx_m);
22646 #if PY_MAJOR_VERSION < 3
22647 __pyx_m = Py_InitModule4(
"superluWrappers", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
22649 __pyx_m = PyModule_Create(&__pyx_moduledef);
22651 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
22653 __pyx_d = PyModule_GetDict(__pyx_m);
if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
22654 Py_INCREF(__pyx_d);
22655 __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME);
if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
22656 Py_INCREF(__pyx_b);
22657 __pyx_cython_runtime = PyImport_AddModule((
char *)
"cython_runtime");
if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
22658 Py_INCREF(__pyx_cython_runtime);
22659 if (PyObject_SetAttrString(__pyx_m,
"__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
22661 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22662 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
22663 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22665 if (__pyx_module_is_main_superluWrappers) {
22666 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22668 #if PY_MAJOR_VERSION >= 3
22670 PyObject *modules = PyImport_GetModuleDict();
if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
22671 if (!PyDict_GetItemString(modules,
"superluWrappers")) {
22672 if (unlikely(PyDict_SetItemString(modules,
"superluWrappers", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
22677 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22679 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22681 (void)__Pyx_modinit_global_init_code();
22682 (void)__Pyx_modinit_variable_export_code();
22683 (void)__Pyx_modinit_function_export_code();
22684 if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
22685 if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
22686 (void)__Pyx_modinit_variable_import_code();
22687 (void)__Pyx_modinit_function_import_code();
22689 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
22690 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22700 __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error)
22701 __Pyx_GOTREF(__pyx_t_1);
22702 if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 7, __pyx_L1_error)
22703 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22712 __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__29);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error)
22713 __Pyx_GOTREF(__pyx_t_1);
22714 __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_tuple__29, __pyx_n_s_SparseMatrix, __pyx_n_s_SparseMatrix, (PyObject *) NULL, __pyx_n_s_superluWrappers, (PyObject *) NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error)
22715 __Pyx_GOTREF(__pyx_t_2);
22724 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_15superluWrappers_12SparseMatrix_1__init__, 0, __pyx_n_s_SparseMatrix___init, NULL, __pyx_n_s_superluWrappers, __pyx_d, ((PyObject *)__pyx_codeobj__31));
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 15, __pyx_L1_error)
22725 __Pyx_GOTREF(__pyx_t_3);
22726 if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_3) < 0) __PYX_ERR(0, 15, __pyx_L1_error)
22727 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22736 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_15superluWrappers_12SparseMatrix_3matvec, 0, __pyx_n_s_SparseMatrix_matvec, NULL, __pyx_n_s_superluWrappers, __pyx_d, ((PyObject *)__pyx_codeobj__33));
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 35, __pyx_L1_error)
22737 __Pyx_GOTREF(__pyx_t_3);
22738 if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_matvec, __pyx_t_3) < 0) __PYX_ERR(0, 35, __pyx_L1_error)
22739 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22748 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_15superluWrappers_12SparseMatrix_5fwrite, 0, __pyx_n_s_SparseMatrix_fwrite, NULL, __pyx_n_s_superluWrappers, __pyx_d, ((PyObject *)__pyx_codeobj__35));
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 46, __pyx_L1_error)
22749 __Pyx_GOTREF(__pyx_t_3);
22750 if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_fwrite, __pyx_t_3) < 0) __PYX_ERR(0, 46, __pyx_L1_error)
22751 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22760 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_15superluWrappers_12SparseMatrix_7getCSRrepresentation, 0, __pyx_n_s_SparseMatrix_getCSRrepresentatio, NULL, __pyx_n_s_superluWrappers, __pyx_d, ((PyObject *)__pyx_codeobj__37));
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 62, __pyx_L1_error)
22761 __Pyx_GOTREF(__pyx_t_3);
22762 if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_getCSRrepresentation, __pyx_t_3) < 0) __PYX_ERR(0, 62, __pyx_L1_error)
22763 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22772 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_15superluWrappers_12SparseMatrix_9getSubMatCSRrepresentation, 0, __pyx_n_s_SparseMatrix_getSubMatCSRreprese, NULL, __pyx_n_s_superluWrappers, __pyx_d, ((PyObject *)__pyx_codeobj__39));
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 72, __pyx_L1_error)
22773 __Pyx_GOTREF(__pyx_t_3);
22774 if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_getSubMatCSRrepresentation, __pyx_t_3) < 0) __PYX_ERR(0, 72, __pyx_L1_error)
22775 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22784 __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_SparseMatrix, __pyx_tuple__29, __pyx_t_2, NULL, 0, 1);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 13, __pyx_L1_error)
22785 __Pyx_GOTREF(__pyx_t_3);
22786 if (PyDict_SetItem(__pyx_d, __pyx_n_s_SparseMatrix, __pyx_t_3) < 0) __PYX_ERR(0, 13, __pyx_L1_error)
22787 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22788 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22789 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22798 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_15superluWrappers_1sparseFactorPrepare, NULL, __pyx_n_s_superluWrappers);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 219, __pyx_L1_error)
22799 __Pyx_GOTREF(__pyx_t_1);
22800 if (PyDict_SetItem(__pyx_d, __pyx_n_s_sparseFactorPrepare, __pyx_t_1) < 0) __PYX_ERR(0, 219, __pyx_L1_error)
22801 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22810 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_15superluWrappers_3sparseFactorSolve, NULL, __pyx_n_s_superluWrappers);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 286, __pyx_L1_error)
22811 __Pyx_GOTREF(__pyx_t_1);
22812 if (PyDict_SetItem(__pyx_d, __pyx_n_s_sparseFactorSolve, __pyx_t_1) < 0) __PYX_ERR(0, 286, __pyx_L1_error)
22813 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22820 __pyx_t_1 = __Pyx_PyDict_NewPresized(0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
22821 __Pyx_GOTREF(__pyx_t_1);
22822 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22823 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22832 __pyx_t_1 = __pyx_capsule_create(((
void *)(&__pyx_array_getbuffer)), ((
char *)
"getbuffer(obj, view, flags)"));
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 209, __pyx_L1_error)
22833 __Pyx_GOTREF(__pyx_t_1);
22834 if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(1, 209, __pyx_L1_error)
22835 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22836 PyType_Modified(__pyx_array_type);
22845 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__44, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 286, __pyx_L1_error)
22846 __Pyx_GOTREF(__pyx_t_1);
22847 __Pyx_XGOTREF(
generic);
22848 __Pyx_DECREF_SET(
generic, __pyx_t_1);
22849 __Pyx_GIVEREF(__pyx_t_1);
22859 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__45, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 287, __pyx_L1_error)
22860 __Pyx_GOTREF(__pyx_t_1);
22861 __Pyx_XGOTREF(strided);
22862 __Pyx_DECREF_SET(strided, __pyx_t_1);
22863 __Pyx_GIVEREF(__pyx_t_1);
22873 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__46, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 288, __pyx_L1_error)
22874 __Pyx_GOTREF(__pyx_t_1);
22875 __Pyx_XGOTREF(indirect);
22876 __Pyx_DECREF_SET(indirect, __pyx_t_1);
22877 __Pyx_GIVEREF(__pyx_t_1);
22887 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__47, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 291, __pyx_L1_error)
22888 __Pyx_GOTREF(__pyx_t_1);
22889 __Pyx_XGOTREF(contiguous);
22890 __Pyx_DECREF_SET(contiguous, __pyx_t_1);
22891 __Pyx_GIVEREF(__pyx_t_1);
22901 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__48, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 292, __pyx_L1_error)
22902 __Pyx_GOTREF(__pyx_t_1);
22903 __Pyx_XGOTREF(indirect_contiguous);
22904 __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_1);
22905 __Pyx_GIVEREF(__pyx_t_1);
22915 __pyx_memoryview_thread_locks_used = 0;
22924 __pyx_t_4[0] = PyThread_allocate_lock();
22925 __pyx_t_4[1] = PyThread_allocate_lock();
22926 __pyx_t_4[2] = PyThread_allocate_lock();
22927 __pyx_t_4[3] = PyThread_allocate_lock();
22928 __pyx_t_4[4] = PyThread_allocate_lock();
22929 __pyx_t_4[5] = PyThread_allocate_lock();
22930 __pyx_t_4[6] = PyThread_allocate_lock();
22931 __pyx_t_4[7] = PyThread_allocate_lock();
22932 memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_4,
sizeof(__pyx_memoryview_thread_locks[0]) * (8));
22941 __pyx_t_1 = __pyx_capsule_create(((
void *)(&__pyx_memoryview_getbuffer)), ((
char *)
"getbuffer(obj, view, flags)"));
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 549, __pyx_L1_error)
22942 __Pyx_GOTREF(__pyx_t_1);
22943 if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(1, 549, __pyx_L1_error)
22944 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22945 PyType_Modified(__pyx_memoryview_type);
22954 __pyx_t_1 = __pyx_capsule_create(((
void *)(&__pyx_memoryview_getbuffer)), ((
char *)
"getbuffer(obj, view, flags)"));
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 995, __pyx_L1_error)
22955 __Pyx_GOTREF(__pyx_t_1);
22956 if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(1, 995, __pyx_L1_error)
22957 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22958 PyType_Modified(__pyx_memoryviewslice_type);
22965 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
22966 __Pyx_GOTREF(__pyx_t_1);
22967 if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
22968 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22982 __Pyx_XDECREF(__pyx_t_1);
22983 __Pyx_XDECREF(__pyx_t_2);
22984 __Pyx_XDECREF(__pyx_t_3);
22987 __Pyx_AddTraceback(
"init superluWrappers", __pyx_clineno, __pyx_lineno, __pyx_filename);
22990 }
else if (!PyErr_Occurred()) {
22991 PyErr_SetString(PyExc_ImportError,
"init superluWrappers");
22994 __Pyx_RefNannyFinishContext();
22995 #if CYTHON_PEP489_MULTI_PHASE_INIT
22996 return (__pyx_m != NULL) ? 0 : -1;
22997 #elif PY_MAJOR_VERSION >= 3
23006 #if CYTHON_REFNANNY
23007 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(
const char *modname) {
23008 PyObject *m = NULL, *p = NULL;
23010 m = PyImport_ImportModule(modname);
23012 p = PyObject_GetAttrString(m,
"RefNannyAPI");
23014 r = PyLong_AsVoidPtr(p);
23018 return (__Pyx_RefNannyAPIStruct *)
r;
23023 #if CYTHON_USE_TYPE_SLOTS
23024 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
23025 PyTypeObject* tp = Py_TYPE(obj);
23026 if (likely(tp->tp_getattro))
23027 return tp->tp_getattro(obj, attr_name);
23028 #if PY_MAJOR_VERSION < 3
23029 if (likely(tp->tp_getattr))
23030 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
23032 return PyObject_GetAttr(obj, attr_name);
23037 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
23038 PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
23039 if (unlikely(!result)) {
23040 PyErr_Format(PyExc_NameError,
23041 #
if PY_MAJOR_VERSION >= 3
23042 "name '%U' is not defined", name);
23044 "name '%.200s' is not defined", PyString_AS_STRING(name));
23051 static void __Pyx_RaiseArgtupleInvalid(
23052 const char* func_name,
23054 Py_ssize_t num_min,
23055 Py_ssize_t num_max,
23056 Py_ssize_t num_found)
23058 Py_ssize_t num_expected;
23059 const char *more_or_less;
23060 if (num_found < num_min) {
23061 num_expected = num_min;
23062 more_or_less =
"at least";
23064 num_expected = num_max;
23065 more_or_less =
"at most";
23068 more_or_less =
"exactly";
23070 PyErr_Format(PyExc_TypeError,
23071 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T
"d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T
"d given)",
23072 func_name, more_or_less, num_expected,
23073 (num_expected == 1) ?
"" :
"s", num_found);
23077 static void __Pyx_RaiseDoubleKeywordsError(
23078 const char* func_name,
23081 PyErr_Format(PyExc_TypeError,
23082 #
if PY_MAJOR_VERSION >= 3
23083 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
23085 "%s() got multiple values for keyword argument '%s'", func_name,
23086 PyString_AsString(kw_name));
23091 static int __Pyx_ParseOptionalKeywords(
23093 PyObject **argnames[],
23095 PyObject *values[],
23096 Py_ssize_t num_pos_args,
23097 const char* function_name)
23099 PyObject *key = 0, *value = 0;
23100 Py_ssize_t
pos = 0;
23102 PyObject*** first_kw_arg = argnames + num_pos_args;
23103 while (PyDict_Next(kwds, &
pos, &key, &value)) {
23104 name = first_kw_arg;
23105 while (*name && (**name != key)) name++;
23107 values[name-argnames] = value;
23110 name = first_kw_arg;
23111 #if PY_MAJOR_VERSION < 3
23112 if (likely(PyString_Check(key))) {
23114 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
23115 && _PyString_Eq(**name, key)) {
23116 values[name-argnames] = value;
23121 if (*name)
continue;
23123 PyObject*** argname = argnames;
23124 while (argname != first_kw_arg) {
23125 if ((**argname == key) || (
23126 (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
23127 && _PyString_Eq(**argname, key))) {
23128 goto arg_passed_twice;
23135 if (likely(PyUnicode_Check(key))) {
23137 int cmp = (**name == key) ? 0 :
23138 #
if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
23139 (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
23141 PyUnicode_Compare(**name, key);
23142 if (cmp < 0 && unlikely(PyErr_Occurred()))
goto bad;
23144 values[name-argnames] = value;
23149 if (*name)
continue;
23151 PyObject*** argname = argnames;
23152 while (argname != first_kw_arg) {
23153 int cmp = (**argname == key) ? 0 :
23154 #
if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
23155 (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
23157 PyUnicode_Compare(**argname, key);
23158 if (cmp < 0 && unlikely(PyErr_Occurred()))
goto bad;
23159 if (cmp == 0)
goto arg_passed_twice;
23164 goto invalid_keyword_type;
23166 if (unlikely(PyDict_SetItem(kwds2, key, value)))
goto bad;
23168 goto invalid_keyword;
23173 __Pyx_RaiseDoubleKeywordsError(function_name, key);
23175 invalid_keyword_type:
23176 PyErr_Format(PyExc_TypeError,
23177 "%.200s() keywords must be strings", function_name);
23180 PyErr_Format(PyExc_TypeError,
23181 #
if PY_MAJOR_VERSION < 3
23182 "%.200s() got an unexpected keyword argument '%.200s'",
23183 function_name, PyString_AsString(key));
23185 "%s() got an unexpected keyword argument '%U'",
23186 function_name, key);
23193 #if CYTHON_USE_TYPE_SLOTS
23194 static CYTHON_INLINE
int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
23195 PyTypeObject* tp = Py_TYPE(obj);
23196 if (likely(tp->tp_setattro))
23197 return tp->tp_setattro(obj, attr_name, value);
23198 #if PY_MAJOR_VERSION < 3
23199 if (likely(tp->tp_setattr))
23200 return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
23202 return PyObject_SetAttr(obj, attr_name, value);
23207 #if CYTHON_COMPILING_IN_CPYTHON
23208 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
23210 ternaryfunc call = func->ob_type->tp_call;
23211 if (unlikely(!call))
23212 return PyObject_Call(func, arg, kw);
23213 if (unlikely(Py_EnterRecursiveCall((
char*)
" while calling a Python object")))
23215 result = (*call)(func, arg, kw);
23216 Py_LeaveRecursiveCall();
23217 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
23220 "NULL result without error in PyObject_Call");
23227 static CYTHON_INLINE
int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
23228 if (unlikely(!type)) {
23229 PyErr_SetString(PyExc_SystemError,
"Missing type object");
23232 if (likely(__Pyx_TypeCheck(obj, type)))
23234 PyErr_Format(PyExc_TypeError,
"Cannot convert %.200s to %.200s",
23235 Py_TYPE(obj)->tp_name, type->tp_name);
23241 __Pyx_init_memviewslice(
struct __pyx_memoryview_obj *memview,
23243 __Pyx_memviewslice *memviewslice,
23244 int memview_is_new_reference)
23246 __Pyx_RefNannyDeclarations
23248 Py_buffer *buf = &memview->view;
23249 __Pyx_RefNannySetupContext(
"init_memviewslice", 0);
23250 if (unlikely(memviewslice->memview || memviewslice->data)) {
23251 PyErr_SetString(PyExc_ValueError,
23252 "memviewslice is already initialized!");
23255 if (buf->strides) {
23256 for (i = 0; i < ndim; i++) {
23257 memviewslice->strides[i] = buf->strides[i];
23260 Py_ssize_t stride = buf->itemsize;
23261 for (i = ndim - 1; i >= 0; i--) {
23262 memviewslice->strides[i] = stride;
23263 stride *= buf->shape[i];
23266 for (i = 0; i < ndim; i++) {
23267 memviewslice->shape[i] = buf->shape[i];
23268 if (buf->suboffsets) {
23269 memviewslice->suboffsets[i] = buf->suboffsets[i];
23271 memviewslice->suboffsets[i] = -1;
23274 memviewslice->memview = memview;
23275 memviewslice->data = (
char *)buf->buf;
23276 if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) {
23277 Py_INCREF(memview);
23282 memviewslice->memview = 0;
23283 memviewslice->data = 0;
23286 __Pyx_RefNannyFinishContext();
23289 #ifndef Py_NO_RETURN
23290 #define Py_NO_RETURN
23292 static void __pyx_fatalerror(
const char *fmt, ...) Py_NO_RETURN {
23295 #ifdef HAVE_STDARG_PROTOTYPES
23296 va_start(vargs, fmt);
23300 vsnprintf(msg, 200, fmt, vargs);
23302 Py_FatalError(msg);
23304 static CYTHON_INLINE
int
23305 __pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
23306 PyThread_type_lock lock)
23309 PyThread_acquire_lock(lock, 1);
23310 result = (*acquisition_count)++;
23311 PyThread_release_lock(lock);
23314 static CYTHON_INLINE
int
23315 __pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
23316 PyThread_type_lock lock)
23319 PyThread_acquire_lock(lock, 1);
23320 result = (*acquisition_count)--;
23321 PyThread_release_lock(lock);
23324 static CYTHON_INLINE
void
23325 __Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice,
int have_gil,
int lineno)
23328 struct __pyx_memoryview_obj *memview = memslice->memview;
23329 if (unlikely(!memview || (PyObject *) memview == Py_None))
23331 if (unlikely(__pyx_get_slice_count(memview) < 0))
23332 __pyx_fatalerror(
"Acquisition count is %d (line %d)",
23333 __pyx_get_slice_count(memview), lineno);
23334 first_time = __pyx_add_acquisition_count(memview) == 0;
23335 if (unlikely(first_time)) {
23337 Py_INCREF((PyObject *) memview);
23339 PyGILState_STATE _gilstate = PyGILState_Ensure();
23340 Py_INCREF((PyObject *) memview);
23341 PyGILState_Release(_gilstate);
23345 static CYTHON_INLINE
void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice,
23346 int have_gil,
int lineno) {
23348 struct __pyx_memoryview_obj *memview = memslice->memview;
23349 if (unlikely(!memview || (PyObject *) memview == Py_None)) {
23350 memslice->memview = NULL;
23353 if (unlikely(__pyx_get_slice_count(memview) <= 0))
23354 __pyx_fatalerror(
"Acquisition count is %d (line %d)",
23355 __pyx_get_slice_count(memview), lineno);
23356 last_time = __pyx_sub_acquisition_count(memview) == 1;
23357 memslice->data = NULL;
23358 if (unlikely(last_time)) {
23360 Py_CLEAR(memslice->memview);
23362 PyGILState_STATE _gilstate = PyGILState_Ensure();
23363 Py_CLEAR(memslice->memview);
23364 PyGILState_Release(_gilstate);
23367 memslice->memview = NULL;
23372 #if CYTHON_FAST_PYCALL
23373 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
23374 PyObject *globals) {
23376 PyThreadState *tstate = __Pyx_PyThreadState_Current;
23377 PyObject **fastlocals;
23380 assert(globals != NULL);
23385 assert(tstate != NULL);
23386 f = PyFrame_New(tstate, co, globals, NULL);
23390 fastlocals = __Pyx_PyFrame_GetLocalsplus(
f);
23391 for (i = 0; i < na; i++) {
23393 fastlocals[i] = *args++;
23395 result = PyEval_EvalFrameEx(
f,0);
23396 ++tstate->recursion_depth;
23398 --tstate->recursion_depth;
23401 #if 1 || PY_VERSION_HEX < 0x030600B1
23402 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
23403 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
23404 PyObject *globals = PyFunction_GET_GLOBALS(func);
23405 PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
23407 #if PY_MAJOR_VERSION >= 3
23410 PyObject *kwtuple, **k;
23415 assert(kwargs == NULL || PyDict_Check(kwargs));
23416 nk = kwargs ? PyDict_Size(kwargs) : 0;
23417 if (Py_EnterRecursiveCall((
char*)
" while calling a Python object")) {
23421 #
if PY_MAJOR_VERSION >= 3
23422 co->co_kwonlyargcount == 0 &&
23424 likely(kwargs == NULL || nk == 0) &&
23425 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
23426 if (argdefs == NULL && co->co_argcount == nargs) {
23427 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
23430 else if (nargs == 0 && argdefs != NULL
23431 && co->co_argcount == Py_SIZE(argdefs)) {
23434 args = &PyTuple_GET_ITEM(argdefs, 0);
23435 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
23439 if (kwargs != NULL) {
23441 kwtuple = PyTuple_New(2 * nk);
23442 if (kwtuple == NULL) {
23446 k = &PyTuple_GET_ITEM(kwtuple, 0);
23448 while (PyDict_Next(kwargs, &
pos, &k[i], &k[i+1])) {
23459 closure = PyFunction_GET_CLOSURE(func);
23460 #if PY_MAJOR_VERSION >= 3
23461 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
23463 if (argdefs != NULL) {
23464 d = &PyTuple_GET_ITEM(argdefs, 0);
23465 nd = Py_SIZE(argdefs);
23471 #if PY_MAJOR_VERSION >= 3
23472 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
23475 d, (
int)nd, kwdefs, closure);
23477 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
23480 d, (
int)nd, closure);
23482 Py_XDECREF(kwtuple);
23484 Py_LeaveRecursiveCall();
23491 #if CYTHON_COMPILING_IN_CPYTHON
23492 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
23493 PyObject *
self, *result;
23495 cfunc = PyCFunction_GET_FUNCTION(func);
23496 self = PyCFunction_GET_SELF(func);
23497 if (unlikely(Py_EnterRecursiveCall((
char*)
" while calling a Python object")))
23499 result = cfunc(
self, arg);
23500 Py_LeaveRecursiveCall();
23501 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
23504 "NULL result without error in PyObject_Call");
23511 #if CYTHON_COMPILING_IN_CPYTHON
23512 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
23513 #if CYTHON_FAST_PYCALL
23514 if (PyFunction_Check(func)) {
23515 return __Pyx_PyFunction_FastCall(func, NULL, 0);
23518 #ifdef __Pyx_CyFunction_USED
23519 if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
23521 if (likely(PyCFunction_Check(func)))
23524 if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
23525 return __Pyx_PyObject_CallMethO(func, NULL);
23528 return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
23533 #if CYTHON_FAST_PYCCALL
23534 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
23535 PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
23536 PyCFunction meth = PyCFunction_GET_FUNCTION(func);
23537 PyObject *
self = PyCFunction_GET_SELF(func);
23538 int flags = PyCFunction_GET_FLAGS(func);
23539 assert(PyCFunction_Check(func));
23540 assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
23541 assert(nargs >= 0);
23542 assert(nargs == 0 || args != NULL);
23546 assert(!PyErr_Occurred());
23547 if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
23548 return (*((__Pyx_PyCFunctionFastWithKeywords)(
void*)meth)) (
self, args, nargs, NULL);
23550 return (*((__Pyx_PyCFunctionFast)(
void*)meth)) (
self, args, nargs);
23556 #if CYTHON_COMPILING_IN_CPYTHON
23557 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
23559 PyObject *args = PyTuple_New(1);
23560 if (unlikely(!args))
return NULL;
23562 PyTuple_SET_ITEM(args, 0, arg);
23563 result = __Pyx_PyObject_Call(func, args, NULL);
23567 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
23568 #if CYTHON_FAST_PYCALL
23569 if (PyFunction_Check(func)) {
23570 return __Pyx_PyFunction_FastCall(func, &arg, 1);
23573 if (likely(PyCFunction_Check(func))) {
23574 if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
23575 return __Pyx_PyObject_CallMethO(func, arg);
23576 #if CYTHON_FAST_PYCCALL
23577 }
else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
23578 return __Pyx_PyCFunction_FastCall(func, &arg, 1);
23582 return __Pyx__PyObject_CallOneArg(func, arg);
23585 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
23587 PyObject *args = PyTuple_Pack(1, arg);
23588 if (unlikely(!args))
return NULL;
23589 result = __Pyx_PyObject_Call(func, args, NULL);
23596 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
23598 if (!j)
return NULL;
23599 r = PyObject_GetItem(o, j);
23603 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
23604 CYTHON_NCP_UNUSED
int wraparound,
23605 CYTHON_NCP_UNUSED
int boundscheck) {
23606 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
23607 Py_ssize_t wrapped_i = i;
23608 if (wraparound & unlikely(i < 0)) {
23609 wrapped_i += PyList_GET_SIZE(o);
23611 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
23612 PyObject *
r = PyList_GET_ITEM(o, wrapped_i);
23616 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
23618 return PySequence_GetItem(o, i);
23621 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
23622 CYTHON_NCP_UNUSED
int wraparound,
23623 CYTHON_NCP_UNUSED
int boundscheck) {
23624 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
23625 Py_ssize_t wrapped_i = i;
23626 if (wraparound & unlikely(i < 0)) {
23627 wrapped_i += PyTuple_GET_SIZE(o);
23629 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
23630 PyObject *
r = PyTuple_GET_ITEM(o, wrapped_i);
23634 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
23636 return PySequence_GetItem(o, i);
23639 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
int is_list,
23640 CYTHON_NCP_UNUSED
int wraparound,
23641 CYTHON_NCP_UNUSED
int boundscheck) {
23642 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
23643 if (is_list || PyList_CheckExact(o)) {
23644 Py_ssize_t
n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
23645 if ((!boundscheck) || (likely(__Pyx_is_valid_index(
n, PyList_GET_SIZE(o))))) {
23646 PyObject *
r = PyList_GET_ITEM(o,
n);
23651 else if (PyTuple_CheckExact(o)) {
23652 Py_ssize_t
n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
23653 if ((!boundscheck) || likely(__Pyx_is_valid_index(
n, PyTuple_GET_SIZE(o)))) {
23654 PyObject *
r = PyTuple_GET_ITEM(o,
n);
23659 PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
23660 if (likely(m && m->sq_item)) {
23661 if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
23662 Py_ssize_t l = m->sq_length(o);
23663 if (likely(l >= 0)) {
23666 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
23671 return m->sq_item(o, i);
23675 if (is_list || PySequence_Check(o)) {
23676 return PySequence_GetItem(o, i);
23679 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
23683 #if CYTHON_USE_TYPE_SLOTS
23684 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
23686 Py_ssize_t key_value;
23687 PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
23688 if (unlikely(!(m && m->sq_item))) {
23689 PyErr_Format(PyExc_TypeError,
"'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
23692 key_value = __Pyx_PyIndex_AsSsize_t(index);
23693 if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
23694 return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
23696 if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
23698 PyErr_Format(PyExc_IndexError,
"cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
23702 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
23703 PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
23704 if (likely(m && m->mp_subscript)) {
23705 return m->mp_subscript(obj, key);
23707 return __Pyx_PyObject_GetIndex(obj, key);
23712 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject*
function, PyObject* arg1, PyObject* arg2) {
23713 PyObject *args, *result = NULL;
23714 #if CYTHON_FAST_PYCALL
23715 if (PyFunction_Check(
function)) {
23716 PyObject *args[2] = {arg1, arg2};
23717 return __Pyx_PyFunction_FastCall(
function, args, 2);
23720 #if CYTHON_FAST_PYCCALL
23721 if (__Pyx_PyFastCFunction_Check(
function)) {
23722 PyObject *args[2] = {arg1, arg2};
23723 return __Pyx_PyCFunction_FastCall(
function, args, 2);
23726 args = PyTuple_New(2);
23727 if (unlikely(!args))
goto done;
23729 PyTuple_SET_ITEM(args, 0, arg1);
23731 PyTuple_SET_ITEM(args, 1, arg2);
23732 Py_INCREF(
function);
23733 result = __Pyx_PyObject_Call(
function, args, NULL);
23735 Py_DECREF(
function);
23741 #if !CYTHON_COMPILING_IN_PYPY
23742 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED
long intval,
int inplace,
int zerodivision_check) {
23744 (void)zerodivision_check;
23745 #if PY_MAJOR_VERSION < 3
23746 if (likely(PyInt_CheckExact(op1))) {
23747 const long b = intval;
23749 long a = PyInt_AS_LONG(op1);
23750 x = (long)((
unsigned long)a + b);
23751 if (likely((x^a) >= 0 || (x^b) >= 0))
23752 return PyInt_FromLong(x);
23753 return PyLong_Type.tp_as_number->nb_add(op1, op2);
23756 #if CYTHON_USE_PYLONG_INTERNALS
23757 if (likely(PyLong_CheckExact(op1))) {
23758 const long b = intval;
23760 #ifdef HAVE_LONG_LONG
23761 const PY_LONG_LONG llb = intval;
23762 PY_LONG_LONG lla, llx;
23764 const digit* digits = ((PyLongObject*)op1)->ob_digit;
23765 const Py_ssize_t size = Py_SIZE(op1);
23766 if (likely(__Pyx_sst_abs(size) <= 1)) {
23767 a = likely(size) ? digits[0] : 0;
23768 if (size == -1) a = -a;
23772 if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
23773 a = -(long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
23775 #ifdef HAVE_LONG_LONG
23776 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
23777 lla = -(PY_LONG_LONG) (((((
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
23781 CYTHON_FALLTHROUGH;
23783 if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
23784 a = (long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
23786 #ifdef HAVE_LONG_LONG
23787 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
23788 lla = (PY_LONG_LONG) (((((
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
23792 CYTHON_FALLTHROUGH;
23794 if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
23795 a = -(long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
23797 #ifdef HAVE_LONG_LONG
23798 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
23799 lla = -(PY_LONG_LONG) (((((((
unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
23803 CYTHON_FALLTHROUGH;
23805 if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
23806 a = (long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
23808 #ifdef HAVE_LONG_LONG
23809 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
23810 lla = (PY_LONG_LONG) (((((((
unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
23814 CYTHON_FALLTHROUGH;
23816 if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
23817 a = -(long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
23819 #ifdef HAVE_LONG_LONG
23820 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
23821 lla = -(PY_LONG_LONG) (((((((((
unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
23825 CYTHON_FALLTHROUGH;
23827 if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
23828 a = (long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
23830 #ifdef HAVE_LONG_LONG
23831 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
23832 lla = (PY_LONG_LONG) (((((((((
unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
23836 CYTHON_FALLTHROUGH;
23837 default:
return PyLong_Type.tp_as_number->nb_add(op1, op2);
23841 return PyLong_FromLong(x);
23842 #ifdef HAVE_LONG_LONG
23845 return PyLong_FromLongLong(llx);
23851 if (PyFloat_CheckExact(op1)) {
23852 const long b = intval;
23853 double a = PyFloat_AS_DOUBLE(op1);
23855 PyFPE_START_PROTECT(
"add",
return NULL)
23856 result = ((double)a) + (double)b;
23857 PyFPE_END_PROTECT(result)
23858 return PyFloat_FromDouble(result);
23860 return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
23865 #if CYTHON_USE_EXC_INFO_STACK
23866 static _PyErr_StackItem *
23867 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
23869 _PyErr_StackItem *exc_info = tstate->exc_info;
23870 while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
23871 exc_info->previous_item != NULL)
23873 exc_info = exc_info->previous_item;
23880 #if CYTHON_FAST_THREAD_STATE
23881 static CYTHON_INLINE
void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
23882 #if CYTHON_USE_EXC_INFO_STACK
23883 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
23884 *type = exc_info->exc_type;
23885 *value = exc_info->exc_value;
23886 *tb = exc_info->exc_traceback;
23888 *type = tstate->exc_type;
23889 *value = tstate->exc_value;
23890 *tb = tstate->exc_traceback;
23893 Py_XINCREF(*value);
23896 static CYTHON_INLINE
void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
23897 PyObject *tmp_type, *tmp_value, *tmp_tb;
23898 #if CYTHON_USE_EXC_INFO_STACK
23899 _PyErr_StackItem *exc_info = tstate->exc_info;
23900 tmp_type = exc_info->exc_type;
23901 tmp_value = exc_info->exc_value;
23902 tmp_tb = exc_info->exc_traceback;
23903 exc_info->exc_type = type;
23904 exc_info->exc_value = value;
23905 exc_info->exc_traceback = tb;
23907 tmp_type = tstate->exc_type;
23908 tmp_value = tstate->exc_value;
23909 tmp_tb = tstate->exc_traceback;
23910 tstate->exc_type = type;
23911 tstate->exc_value = value;
23912 tstate->exc_traceback = tb;
23914 Py_XDECREF(tmp_type);
23915 Py_XDECREF(tmp_value);
23916 Py_XDECREF(tmp_tb);
23921 #if CYTHON_FAST_THREAD_STATE
23922 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
23924 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
23927 PyObject *local_type, *local_value, *local_tb;
23928 #if CYTHON_FAST_THREAD_STATE
23929 PyObject *tmp_type, *tmp_value, *tmp_tb;
23930 local_type = tstate->curexc_type;
23931 local_value = tstate->curexc_value;
23932 local_tb = tstate->curexc_traceback;
23933 tstate->curexc_type = 0;
23934 tstate->curexc_value = 0;
23935 tstate->curexc_traceback = 0;
23937 PyErr_Fetch(&local_type, &local_value, &local_tb);
23939 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
23940 #if CYTHON_FAST_THREAD_STATE
23941 if (unlikely(tstate->curexc_type))
23943 if (unlikely(PyErr_Occurred()))
23946 #if PY_MAJOR_VERSION >= 3
23948 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
23952 Py_XINCREF(local_tb);
23953 Py_XINCREF(local_type);
23954 Py_XINCREF(local_value);
23955 *type = local_type;
23956 *value = local_value;
23958 #if CYTHON_FAST_THREAD_STATE
23959 #if CYTHON_USE_EXC_INFO_STACK
23961 _PyErr_StackItem *exc_info = tstate->exc_info;
23962 tmp_type = exc_info->exc_type;
23963 tmp_value = exc_info->exc_value;
23964 tmp_tb = exc_info->exc_traceback;
23965 exc_info->exc_type = local_type;
23966 exc_info->exc_value = local_value;
23967 exc_info->exc_traceback = local_tb;
23970 tmp_type = tstate->exc_type;
23971 tmp_value = tstate->exc_value;
23972 tmp_tb = tstate->exc_traceback;
23973 tstate->exc_type = local_type;
23974 tstate->exc_value = local_value;
23975 tstate->exc_traceback = local_tb;
23977 Py_XDECREF(tmp_type);
23978 Py_XDECREF(tmp_value);
23979 Py_XDECREF(tmp_tb);
23981 PyErr_SetExcInfo(local_type, local_value, local_tb);
23988 Py_XDECREF(local_type);
23989 Py_XDECREF(local_value);
23990 Py_XDECREF(local_tb);
23995 #if CYTHON_FAST_THREAD_STATE
23996 static CYTHON_INLINE
void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
23997 PyObject *tmp_type, *tmp_value, *tmp_tb;
23998 tmp_type = tstate->curexc_type;
23999 tmp_value = tstate->curexc_value;
24000 tmp_tb = tstate->curexc_traceback;
24001 tstate->curexc_type = type;
24002 tstate->curexc_value = value;
24003 tstate->curexc_traceback = tb;
24004 Py_XDECREF(tmp_type);
24005 Py_XDECREF(tmp_value);
24006 Py_XDECREF(tmp_tb);
24008 static CYTHON_INLINE
void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
24009 *type = tstate->curexc_type;
24010 *value = tstate->curexc_value;
24011 *tb = tstate->curexc_traceback;
24012 tstate->curexc_type = 0;
24013 tstate->curexc_value = 0;
24014 tstate->curexc_traceback = 0;
24019 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
24020 Py_ssize_t cstart, Py_ssize_t cstop,
24021 PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
24022 int has_cstart,
int has_cstop, CYTHON_UNUSED
int wraparound) {
24023 #if CYTHON_USE_TYPE_SLOTS
24024 PyMappingMethods* mp;
24025 #if PY_MAJOR_VERSION < 3
24026 PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
24027 if (likely(ms && ms->sq_slice)) {
24029 if (_py_start && (*_py_start != Py_None)) {
24030 cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
24031 if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred())
goto bad;
24036 if (_py_stop && (*_py_stop != Py_None)) {
24037 cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
24038 if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred())
goto bad;
24040 cstop = PY_SSIZE_T_MAX;
24042 if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
24043 Py_ssize_t l = ms->sq_length(obj);
24044 if (likely(l >= 0)) {
24047 if (cstop < 0) cstop = 0;
24051 if (cstart < 0) cstart = 0;
24054 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
24059 return ms->sq_slice(obj, cstart, cstop);
24062 mp = Py_TYPE(obj)->tp_as_mapping;
24063 if (likely(mp && mp->mp_subscript))
24067 PyObject *py_slice, *py_start, *py_stop;
24069 py_slice = *_py_slice;
24071 PyObject* owned_start = NULL;
24072 PyObject* owned_stop = NULL;
24074 py_start = *_py_start;
24077 owned_start = py_start = PyInt_FromSsize_t(cstart);
24078 if (unlikely(!py_start))
goto bad;
24080 py_start = Py_None;
24083 py_stop = *_py_stop;
24086 owned_stop = py_stop = PyInt_FromSsize_t(cstop);
24087 if (unlikely(!py_stop)) {
24088 Py_XDECREF(owned_start);
24094 py_slice = PySlice_New(py_start, py_stop, Py_None);
24095 Py_XDECREF(owned_start);
24096 Py_XDECREF(owned_stop);
24097 if (unlikely(!py_slice))
goto bad;
24099 #if CYTHON_USE_TYPE_SLOTS
24100 result = mp->mp_subscript(obj, py_slice);
24102 result = PyObject_GetItem(obj, py_slice);
24105 Py_DECREF(py_slice);
24109 PyErr_Format(PyExc_TypeError,
24110 "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
24116 #if PY_MAJOR_VERSION < 3
24117 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
24118 CYTHON_UNUSED PyObject *cause) {
24119 __Pyx_PyThreadState_declare
24121 if (!value || value == Py_None)
24125 if (!tb || tb == Py_None)
24129 if (!PyTraceBack_Check(tb)) {
24130 PyErr_SetString(PyExc_TypeError,
24131 "raise: arg 3 must be a traceback or None");
24135 if (PyType_Check(type)) {
24136 #if CYTHON_COMPILING_IN_PYPY
24138 Py_INCREF(Py_None);
24142 PyErr_NormalizeException(&type, &value, &tb);
24145 PyErr_SetString(PyExc_TypeError,
24146 "instance exception may not have a separate value");
24150 type = (PyObject*) Py_TYPE(type);
24152 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
24153 PyErr_SetString(PyExc_TypeError,
24154 "raise: exception class must be a subclass of BaseException");
24158 __Pyx_PyThreadState_assign
24159 __Pyx_ErrRestore(type, value, tb);
24168 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
24169 PyObject* owned_instance = NULL;
24170 if (tb == Py_None) {
24172 }
else if (tb && !PyTraceBack_Check(tb)) {
24173 PyErr_SetString(PyExc_TypeError,
24174 "raise: arg 3 must be a traceback or None");
24177 if (value == Py_None)
24179 if (PyExceptionInstance_Check(type)) {
24181 PyErr_SetString(PyExc_TypeError,
24182 "instance exception may not have a separate value");
24186 type = (PyObject*) Py_TYPE(value);
24187 }
else if (PyExceptionClass_Check(type)) {
24188 PyObject *instance_class = NULL;
24189 if (value && PyExceptionInstance_Check(value)) {
24190 instance_class = (PyObject*) Py_TYPE(value);
24191 if (instance_class != type) {
24192 int is_subclass = PyObject_IsSubclass(instance_class, type);
24193 if (!is_subclass) {
24194 instance_class = NULL;
24195 }
else if (unlikely(is_subclass == -1)) {
24198 type = instance_class;
24202 if (!instance_class) {
24205 args = PyTuple_New(0);
24206 else if (PyTuple_Check(value)) {
24210 args = PyTuple_Pack(1, value);
24213 owned_instance = PyObject_Call(type, args, NULL);
24215 if (!owned_instance)
24217 value = owned_instance;
24218 if (!PyExceptionInstance_Check(value)) {
24219 PyErr_Format(PyExc_TypeError,
24220 "calling %R should have returned an instance of "
24221 "BaseException, not %R",
24222 type, Py_TYPE(value));
24227 PyErr_SetString(PyExc_TypeError,
24228 "raise: exception class must be a subclass of BaseException");
24232 PyObject *fixed_cause;
24233 if (cause == Py_None) {
24234 fixed_cause = NULL;
24235 }
else if (PyExceptionClass_Check(cause)) {
24236 fixed_cause = PyObject_CallObject(cause, NULL);
24237 if (fixed_cause == NULL)
24239 }
else if (PyExceptionInstance_Check(cause)) {
24240 fixed_cause = cause;
24241 Py_INCREF(fixed_cause);
24243 PyErr_SetString(PyExc_TypeError,
24244 "exception causes must derive from "
24248 PyException_SetCause(value, fixed_cause);
24250 PyErr_SetObject(type, value);
24252 #if CYTHON_COMPILING_IN_PYPY
24253 PyObject *tmp_type, *tmp_value, *tmp_tb;
24254 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
24256 PyErr_Restore(tmp_type, tmp_value, tb);
24257 Py_XDECREF(tmp_tb);
24259 PyThreadState *tstate = __Pyx_PyThreadState_Current;
24260 PyObject* tmp_tb = tstate->curexc_traceback;
24261 if (tb != tmp_tb) {
24263 tstate->curexc_traceback = tb;
24264 Py_XDECREF(tmp_tb);
24269 Py_XDECREF(owned_instance);
24275 static void __Pyx_WriteUnraisable(
const char *name, CYTHON_UNUSED
int clineno,
24276 CYTHON_UNUSED
int lineno, CYTHON_UNUSED
const char *filename,
24277 int full_traceback, CYTHON_UNUSED
int nogil) {
24278 PyObject *old_exc, *old_val, *old_tb;
24280 __Pyx_PyThreadState_declare
24282 PyGILState_STATE state;
24284 state = PyGILState_Ensure();
24286 else state = (PyGILState_STATE)-1;
24289 __Pyx_PyThreadState_assign
24290 __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
24291 if (full_traceback) {
24292 Py_XINCREF(old_exc);
24293 Py_XINCREF(old_val);
24294 Py_XINCREF(old_tb);
24295 __Pyx_ErrRestore(old_exc, old_val, old_tb);
24298 #if PY_MAJOR_VERSION < 3
24299 ctx = PyString_FromString(name);
24301 ctx = PyUnicode_FromString(name);
24303 __Pyx_ErrRestore(old_exc, old_val, old_tb);
24305 PyErr_WriteUnraisable(Py_None);
24307 PyErr_WriteUnraisable(ctx);
24312 PyGILState_Release(state);
24317 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
24318 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
24320 value = PyDict_GetItemWithError(d, key);
24321 if (unlikely(!value)) {
24322 if (!PyErr_Occurred()) {
24323 if (unlikely(PyTuple_Check(key))) {
24324 PyObject* args = PyTuple_Pack(1, key);
24325 if (likely(args)) {
24326 PyErr_SetObject(PyExc_KeyError, args);
24330 PyErr_SetObject(PyExc_KeyError, key);
24341 static CYTHON_INLINE
void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
24342 PyErr_Format(PyExc_ValueError,
24343 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T
"d)", expected);
24347 static CYTHON_INLINE
void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
24348 PyErr_Format(PyExc_ValueError,
24349 "need more than %" CYTHON_FORMAT_SSIZE_T
"d value%.1s to unpack",
24350 index, (index == 1) ?
"" :
"s");
24354 static CYTHON_INLINE
void __Pyx_RaiseNoneNotIterableError(
void) {
24355 PyErr_SetString(PyExc_TypeError,
"'NoneType' object is not iterable");
24359 #if CYTHON_FAST_THREAD_STATE
24360 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
24362 n = PyTuple_GET_SIZE(tuple);
24363 #if PY_MAJOR_VERSION >= 3
24364 for (i=0; i<
n; i++) {
24365 if (exc_type == PyTuple_GET_ITEM(tuple, i))
return 1;
24368 for (i=0; i<
n; i++) {
24369 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i)))
return 1;
24373 static CYTHON_INLINE
int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
24374 PyObject *exc_type = tstate->curexc_type;
24375 if (exc_type == err)
return 1;
24376 if (unlikely(!exc_type))
return 0;
24377 if (unlikely(PyTuple_Check(err)))
24378 return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
24379 return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
24384 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type,
const char *name,
int exact)
24386 if (unlikely(!type)) {
24387 PyErr_SetString(PyExc_SystemError,
"Missing type object");
24391 #if PY_MAJOR_VERSION == 2
24392 if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj)))
return 1;
24396 if (likely(__Pyx_TypeCheck(obj, type)))
return 1;
24398 PyErr_Format(PyExc_TypeError,
24399 "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
24400 name, type->tp_name, Py_TYPE(obj)->tp_name);
24405 static CYTHON_INLINE
int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2,
int equals) {
24406 #if CYTHON_COMPILING_IN_PYPY
24407 return PyObject_RichCompareBool(s1, s2, equals);
24410 return (equals == Py_EQ);
24411 }
else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
24412 const char *ps1, *ps2;
24413 Py_ssize_t length = PyBytes_GET_SIZE(s1);
24414 if (length != PyBytes_GET_SIZE(s2))
24415 return (equals == Py_NE);
24416 ps1 = PyBytes_AS_STRING(s1);
24417 ps2 = PyBytes_AS_STRING(s2);
24418 if (ps1[0] != ps2[0]) {
24419 return (equals == Py_NE);
24420 }
else if (length == 1) {
24421 return (equals == Py_EQ);
24424 #if CYTHON_USE_UNICODE_INTERNALS
24425 Py_hash_t hash1, hash2;
24426 hash1 = ((PyBytesObject*)s1)->ob_shash;
24427 hash2 = ((PyBytesObject*)s2)->ob_shash;
24428 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
24429 return (equals == Py_NE);
24432 result = memcmp(ps1, ps2, (
size_t)length);
24433 return (equals == Py_EQ) ? (result == 0) : (result != 0);
24435 }
else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
24436 return (equals == Py_NE);
24437 }
else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
24438 return (equals == Py_NE);
24441 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
24444 result = __Pyx_PyObject_IsTrue(py_result);
24445 Py_DECREF(py_result);
24452 static CYTHON_INLINE
int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2,
int equals) {
24453 #if CYTHON_COMPILING_IN_PYPY
24454 return PyObject_RichCompareBool(s1, s2, equals);
24456 #if PY_MAJOR_VERSION < 3
24457 PyObject* owned_ref = NULL;
24459 int s1_is_unicode, s2_is_unicode;
24463 s1_is_unicode = PyUnicode_CheckExact(s1);
24464 s2_is_unicode = PyUnicode_CheckExact(s2);
24465 #if PY_MAJOR_VERSION < 3
24466 if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
24467 owned_ref = PyUnicode_FromObject(s2);
24468 if (unlikely(!owned_ref))
24472 }
else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
24473 owned_ref = PyUnicode_FromObject(s1);
24474 if (unlikely(!owned_ref))
24478 }
else if (((!s2_is_unicode) & (!s1_is_unicode))) {
24479 return __Pyx_PyBytes_Equals(s1, s2, equals);
24482 if (s1_is_unicode & s2_is_unicode) {
24485 void *data1, *data2;
24486 if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
24488 length = __Pyx_PyUnicode_GET_LENGTH(s1);
24489 if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
24492 #if CYTHON_USE_UNICODE_INTERNALS
24494 Py_hash_t hash1, hash2;
24495 #if CYTHON_PEP393_ENABLED
24496 hash1 = ((PyASCIIObject*)s1)->hash;
24497 hash2 = ((PyASCIIObject*)s2)->hash;
24499 hash1 = ((PyUnicodeObject*)s1)->hash;
24500 hash2 = ((PyUnicodeObject*)s2)->hash;
24502 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
24507 kind = __Pyx_PyUnicode_KIND(s1);
24508 if (kind != __Pyx_PyUnicode_KIND(s2)) {
24511 data1 = __Pyx_PyUnicode_DATA(s1);
24512 data2 = __Pyx_PyUnicode_DATA(s2);
24513 if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
24515 }
else if (length == 1) {
24518 int result = memcmp(data1, data2, (
size_t)(length * kind));
24519 #if PY_MAJOR_VERSION < 3
24520 Py_XDECREF(owned_ref);
24522 return (equals == Py_EQ) ? (result == 0) : (result != 0);
24524 }
else if ((s1 == Py_None) & s2_is_unicode) {
24526 }
else if ((s2 == Py_None) & s1_is_unicode) {
24530 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
24531 #if PY_MAJOR_VERSION < 3
24532 Py_XDECREF(owned_ref);
24536 result = __Pyx_PyObject_IsTrue(py_result);
24537 Py_DECREF(py_result);
24541 #if PY_MAJOR_VERSION < 3
24542 Py_XDECREF(owned_ref);
24544 return (equals == Py_EQ);
24546 #if PY_MAJOR_VERSION < 3
24547 Py_XDECREF(owned_ref);
24549 return (equals == Py_NE);
24554 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) {
24555 Py_ssize_t
q = a / b;
24556 Py_ssize_t
r = a -
q*b;
24557 q -= ((
r != 0) & ((
r ^ b) < 0));
24562 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *
n) {
24563 #if CYTHON_USE_TYPE_SLOTS
24564 #if PY_MAJOR_VERSION >= 3
24565 if (likely(PyUnicode_Check(
n)))
24567 if (likely(PyString_Check(
n)))
24569 return __Pyx_PyObject_GetAttrStr(o,
n);
24571 return PyObject_GetAttr(o,
n);
24575 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
24576 const char* cstring, Py_ssize_t start, Py_ssize_t stop,
24577 const char* encoding,
const char* errors,
24578 PyObject* (*decode_func)(
const char *
s, Py_ssize_t size,
const char *errors)) {
24580 if (unlikely((start < 0) | (stop < 0))) {
24581 size_t slen = strlen(cstring);
24582 if (unlikely(slen > (
size_t) PY_SSIZE_T_MAX)) {
24583 PyErr_SetString(PyExc_OverflowError,
24584 "c-string too long to convert to Python");
24587 length = (Py_ssize_t) slen;
24596 if (unlikely(stop <= start))
24597 return __Pyx_NewRef(__pyx_empty_unicode);
24598 length = stop - start;
24601 return decode_func(cstring, length, errors);
24603 return PyUnicode_Decode(cstring, length, encoding, errors);
24608 static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
24609 __Pyx_PyThreadState_declare
24610 __Pyx_PyThreadState_assign
24611 if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
24613 __Pyx_PyErr_Clear();
24617 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *
n, PyObject *d) {
24618 PyObject *
r = __Pyx_GetAttr(o,
n);
24619 return (likely(
r)) ?
r : __Pyx_GetAttr3Default(d);
24623 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
24624 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
24625 PyObject *dict = Py_TYPE(obj)->tp_dict;
24626 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
24628 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
24629 PyObject **dictptr = NULL;
24630 Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
24632 #if CYTHON_COMPILING_IN_CPYTHON
24633 dictptr = (likely(offset > 0)) ? (PyObject **) ((
char *)obj + offset) : _PyObject_GetDictPtr(obj);
24635 dictptr = _PyObject_GetDictPtr(obj);
24638 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
24640 static CYTHON_INLINE
int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
24641 PyObject *dict = Py_TYPE(obj)->tp_dict;
24642 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
24644 return obj_dict_version == __Pyx_get_object_dict_version(obj);
24649 #if CYTHON_USE_DICT_VERSIONS
24650 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
24652 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
24656 #if !CYTHON_AVOID_BORROWED_REFS
24657 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
24658 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
24659 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
24660 if (likely(result)) {
24661 return __Pyx_NewRef(result);
24662 }
else if (unlikely(PyErr_Occurred())) {
24666 result = PyDict_GetItem(__pyx_d, name);
24667 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
24668 if (likely(result)) {
24669 return __Pyx_NewRef(result);
24673 result = PyObject_GetItem(__pyx_d, name);
24674 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
24675 if (likely(result)) {
24676 return __Pyx_NewRef(result);
24680 return __Pyx_GetBuiltinName(name);
24684 #if CYTHON_FAST_THREAD_STATE
24685 static CYTHON_INLINE
void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
24686 PyObject *tmp_type, *tmp_value, *tmp_tb;
24687 #if CYTHON_USE_EXC_INFO_STACK
24688 _PyErr_StackItem *exc_info = tstate->exc_info;
24689 tmp_type = exc_info->exc_type;
24690 tmp_value = exc_info->exc_value;
24691 tmp_tb = exc_info->exc_traceback;
24692 exc_info->exc_type = *type;
24693 exc_info->exc_value = *value;
24694 exc_info->exc_traceback = *tb;
24696 tmp_type = tstate->exc_type;
24697 tmp_value = tstate->exc_value;
24698 tmp_tb = tstate->exc_traceback;
24699 tstate->exc_type = *type;
24700 tstate->exc_value = *value;
24701 tstate->exc_traceback = *tb;
24704 *value = tmp_value;
24708 static CYTHON_INLINE
void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
24709 PyObject *tmp_type, *tmp_value, *tmp_tb;
24710 PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
24711 PyErr_SetExcInfo(*type, *value, *tb);
24713 *value = tmp_value;
24719 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list,
int level) {
24720 PyObject *empty_list = 0;
24721 PyObject *module = 0;
24722 PyObject *global_dict = 0;
24723 PyObject *empty_dict = 0;
24725 #if PY_MAJOR_VERSION < 3
24726 PyObject *py_import;
24727 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
24734 empty_list = PyList_New(0);
24739 global_dict = PyModule_GetDict(__pyx_m);
24742 empty_dict = PyDict_New();
24746 #if PY_MAJOR_VERSION >= 3
24748 if ((1) && (strchr(__Pyx_MODULE_NAME,
'.'))) {
24749 module = PyImport_ImportModuleLevelObject(
24750 name, global_dict, empty_dict, list, 1);
24752 if (!PyErr_ExceptionMatches(PyExc_ImportError))
24761 #if PY_MAJOR_VERSION < 3
24762 PyObject *py_level = PyInt_FromLong(level);
24765 module = PyObject_CallFunctionObjArgs(py_import,
24766 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
24767 Py_DECREF(py_level);
24769 module = PyImport_ImportModuleLevelObject(
24770 name, global_dict, empty_dict, list, level);
24775 #if PY_MAJOR_VERSION < 3
24776 Py_XDECREF(py_import);
24778 Py_XDECREF(empty_list);
24779 Py_XDECREF(empty_dict);
24784 #if CYTHON_COMPILING_IN_CPYTHON
24785 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
24791 return b == &PyBaseObject_Type;
24793 static CYTHON_INLINE
int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
24795 if (a == b)
return 1;
24799 n = PyTuple_GET_SIZE(mro);
24800 for (i = 0; i <
n; i++) {
24801 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
24806 return __Pyx_InBases(a, b);
24808 #if PY_MAJOR_VERSION == 2
24809 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
24810 PyObject *exception, *value, *tb;
24812 __Pyx_PyThreadState_declare
24813 __Pyx_PyThreadState_assign
24814 __Pyx_ErrFetch(&exception, &value, &tb);
24815 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
24816 if (unlikely(res == -1)) {
24817 PyErr_WriteUnraisable(err);
24821 res = PyObject_IsSubclass(err, exc_type2);
24822 if (unlikely(res == -1)) {
24823 PyErr_WriteUnraisable(err);
24827 __Pyx_ErrRestore(exception, value, tb);
24831 static CYTHON_INLINE
int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
24832 int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
24834 res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
24839 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
24841 assert(PyExceptionClass_Check(exc_type));
24842 n = PyTuple_GET_SIZE(tuple);
24843 #if PY_MAJOR_VERSION >= 3
24844 for (i=0; i<
n; i++) {
24845 if (exc_type == PyTuple_GET_ITEM(tuple, i))
return 1;
24848 for (i=0; i<
n; i++) {
24849 PyObject *t = PyTuple_GET_ITEM(tuple, i);
24850 #if PY_MAJOR_VERSION < 3
24851 if (likely(exc_type == t))
return 1;
24853 if (likely(PyExceptionClass_Check(t))) {
24854 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t))
return 1;
24860 static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
24861 if (likely(err == exc_type))
return 1;
24862 if (likely(PyExceptionClass_Check(err))) {
24863 if (likely(PyExceptionClass_Check(exc_type))) {
24864 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
24865 }
else if (likely(PyTuple_Check(exc_type))) {
24866 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
24870 return PyErr_GivenExceptionMatches(err, exc_type);
24872 static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
24873 assert(PyExceptionClass_Check(exc_type1));
24874 assert(PyExceptionClass_Check(exc_type2));
24875 if (likely(err == exc_type1 || err == exc_type2))
return 1;
24876 if (likely(PyExceptionClass_Check(err))) {
24877 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
24879 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
24884 static CYTHON_INLINE
void __Pyx_RaiseUnboundLocalError(
const char *varname) {
24885 PyErr_Format(PyExc_UnboundLocalError,
"local variable '%s' referenced before assignment", varname);
24889 static CYTHON_INLINE
long __Pyx_div_long(
long a,
long b) {
24892 q -= ((
r != 0) & ((
r ^ b) < 0));
24897 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
24898 PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
24899 if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
24900 PyErr_Format(PyExc_ImportError,
24901 #
if PY_MAJOR_VERSION < 3
24902 "cannot import name %.230s", PyString_AS_STRING(name));
24904 "cannot import name %S", name);
24911 static CYTHON_INLINE
int __Pyx_HasAttr(PyObject *o, PyObject *
n) {
24913 if (unlikely(!__Pyx_PyBaseString_Check(
n))) {
24914 PyErr_SetString(PyExc_TypeError,
24915 "hasattr(): attribute name must be string");
24918 r = __Pyx_GetAttr(o,
n);
24919 if (unlikely(!
r)) {
24929 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
24930 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
24931 PyErr_Format(PyExc_AttributeError,
24932 #
if PY_MAJOR_VERSION >= 3
24933 "'%.50s' object has no attribute '%U'",
24934 tp->tp_name, attr_name);
24936 "'%.50s' object has no attribute '%.400s'",
24937 tp->tp_name, PyString_AS_STRING(attr_name));
24941 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
24943 PyTypeObject *tp = Py_TYPE(obj);
24944 if (unlikely(!PyString_Check(attr_name))) {
24945 return PyObject_GenericGetAttr(obj, attr_name);
24947 assert(!tp->tp_dictoffset);
24948 descr = _PyType_Lookup(tp, attr_name);
24949 if (unlikely(!descr)) {
24950 return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
24953 #if PY_MAJOR_VERSION < 3
24954 if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
24957 descrgetfunc
f = Py_TYPE(descr)->tp_descr_get;
24959 PyObject *res =
f(descr, obj, (PyObject *)tp);
24969 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
24970 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
24971 if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
24972 return PyObject_GenericGetAttr(obj, attr_name);
24974 return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
24979 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(
void) {
24980 __Pyx_PyThreadState_declare
24981 __Pyx_PyThreadState_assign
24982 if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
24983 __Pyx_PyErr_Clear();
24985 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
24987 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
24988 PyTypeObject* tp = Py_TYPE(obj);
24989 if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
24990 return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
24993 result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
24994 if (unlikely(!result)) {
24995 __Pyx_PyObject_GetAttrStr_ClearAttributeError();
25001 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
25003 PyObject *name_attr;
25004 name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
25005 if (likely(name_attr)) {
25006 ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
25010 if (unlikely(ret < 0)) {
25014 Py_XDECREF(name_attr);
25017 static int __Pyx_setup_reduce(PyObject* type_obj) {
25019 PyObject *object_reduce = NULL;
25020 PyObject *object_reduce_ex = NULL;
25021 PyObject *reduce = NULL;
25022 PyObject *reduce_ex = NULL;
25023 PyObject *reduce_cython = NULL;
25024 PyObject *setstate = NULL;
25025 PyObject *setstate_cython = NULL;
25026 #if CYTHON_USE_PYTYPE_LOOKUP
25027 if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate))
goto __PYX_GOOD;
25029 if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate))
goto __PYX_GOOD;
25031 #if CYTHON_USE_PYTYPE_LOOKUP
25032 object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex);
if (!object_reduce_ex)
goto __PYX_BAD;
25034 object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex);
if (!object_reduce_ex)
goto __PYX_BAD;
25036 reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex);
if (unlikely(!reduce_ex))
goto __PYX_BAD;
25037 if (reduce_ex == object_reduce_ex) {
25038 #if CYTHON_USE_PYTYPE_LOOKUP
25039 object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce);
if (!object_reduce)
goto __PYX_BAD;
25041 object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce);
if (!object_reduce)
goto __PYX_BAD;
25043 reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce);
if (unlikely(!reduce))
goto __PYX_BAD;
25044 if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
25045 reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
25046 if (likely(reduce_cython)) {
25047 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython);
if (unlikely(ret < 0))
goto __PYX_BAD;
25048 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython);
if (unlikely(ret < 0))
goto __PYX_BAD;
25049 }
else if (reduce == object_reduce || PyErr_Occurred()) {
25052 setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
25053 if (!setstate) PyErr_Clear();
25054 if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
25055 setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
25056 if (likely(setstate_cython)) {
25057 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython);
if (unlikely(ret < 0))
goto __PYX_BAD;
25058 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython);
if (unlikely(ret < 0))
goto __PYX_BAD;
25059 }
else if (!setstate || PyErr_Occurred()) {
25063 PyType_Modified((PyTypeObject*)type_obj);
25068 if (!PyErr_Occurred())
25069 PyErr_Format(PyExc_RuntimeError,
"Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
25072 #if !CYTHON_USE_PYTYPE_LOOKUP
25073 Py_XDECREF(object_reduce);
25074 Py_XDECREF(object_reduce_ex);
25076 Py_XDECREF(reduce);
25077 Py_XDECREF(reduce_ex);
25078 Py_XDECREF(reduce_cython);
25079 Py_XDECREF(setstate);
25080 Py_XDECREF(setstate_cython);
25085 static int __Pyx_SetVtable(PyObject *dict,
void *vtable) {
25086 #if PY_VERSION_HEX >= 0x02070000
25087 PyObject *ob = PyCapsule_New(vtable, 0, 0);
25089 PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
25093 if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
25103 #ifndef __PYX_HAVE_RT_ImportType
25104 #define __PYX_HAVE_RT_ImportType
25105 static PyTypeObject *__Pyx_ImportType(PyObject *module,
const char *module_name,
const char *class_name,
25106 size_t size,
enum __Pyx_ImportType_CheckSize check_size)
25108 PyObject *result = 0;
25110 Py_ssize_t basicsize;
25111 #ifdef Py_LIMITED_API
25112 PyObject *py_basicsize;
25114 result = PyObject_GetAttrString(module, class_name);
25117 if (!PyType_Check(result)) {
25118 PyErr_Format(PyExc_TypeError,
25119 "%.200s.%.200s is not a type object",
25120 module_name, class_name);
25123 #ifndef Py_LIMITED_API
25124 basicsize = ((PyTypeObject *)result)->tp_basicsize;
25126 py_basicsize = PyObject_GetAttrString(result,
"__basicsize__");
25129 basicsize = PyLong_AsSsize_t(py_basicsize);
25130 Py_DECREF(py_basicsize);
25132 if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
25135 if ((
size_t)basicsize < size) {
25136 PyErr_Format(PyExc_ValueError,
25137 "%.200s.%.200s size changed, may indicate binary incompatibility. "
25138 "Expected %zd from C header, got %zd from PyObject",
25139 module_name, class_name, size, basicsize);
25142 if (check_size == __Pyx_ImportType_CheckSize_Error && (
size_t)basicsize != size) {
25143 PyErr_Format(PyExc_ValueError,
25144 "%.200s.%.200s size changed, may indicate binary incompatibility. "
25145 "Expected %zd from C header, got %zd from PyObject",
25146 module_name, class_name, size, basicsize);
25149 else if (check_size == __Pyx_ImportType_CheckSize_Warn && (
size_t)basicsize > size) {
25150 PyOS_snprintf(warning,
sizeof(warning),
25151 "%s.%s size changed, may indicate binary incompatibility. "
25152 "Expected %zd from C header, got %zd from PyObject",
25153 module_name, class_name, size, basicsize);
25154 if (PyErr_WarnEx(NULL, warning, 0) < 0)
goto bad;
25156 return (PyTypeObject *)result;
25158 Py_XDECREF(result);
25164 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
25165 Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
25166 for (i=0; i < nbases; i++) {
25167 PyTypeObject *tmptype;
25168 PyObject *tmp = PyTuple_GET_ITEM(bases, i);
25169 tmptype = Py_TYPE(tmp);
25170 #if PY_MAJOR_VERSION < 3
25171 if (tmptype == &PyClass_Type)
25175 metaclass = tmptype;
25178 if (PyType_IsSubtype(metaclass, tmptype))
25180 if (PyType_IsSubtype(tmptype, metaclass)) {
25181 metaclass = tmptype;
25184 PyErr_SetString(PyExc_TypeError,
25185 "metaclass conflict: "
25186 "the metaclass of a derived class "
25187 "must be a (non-strict) subclass "
25188 "of the metaclasses of all its bases");
25192 #if PY_MAJOR_VERSION < 3
25193 metaclass = &PyClass_Type;
25195 metaclass = &PyType_Type;
25198 Py_INCREF((PyObject*) metaclass);
25199 return (PyObject*) metaclass;
25203 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
25204 PyObject* fake_module;
25205 PyTypeObject* cached_type = NULL;
25206 fake_module = PyImport_AddModule((
char*)
"_cython_" CYTHON_ABI);
25207 if (!fake_module)
return NULL;
25208 Py_INCREF(fake_module);
25209 cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
25211 if (!PyType_Check((PyObject*)cached_type)) {
25212 PyErr_Format(PyExc_TypeError,
25213 "Shared Cython type %.200s is not a type object",
25217 if (cached_type->tp_basicsize != type->tp_basicsize) {
25218 PyErr_Format(PyExc_TypeError,
25219 "Shared Cython type %.200s has the wrong size, try recompiling",
25224 if (!PyErr_ExceptionMatches(PyExc_AttributeError))
goto bad;
25226 if (PyType_Ready(type) < 0)
goto bad;
25227 if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
25230 cached_type = type;
25233 Py_DECREF(fake_module);
25234 return cached_type;
25236 Py_XDECREF(cached_type);
25237 cached_type = NULL;
25242 #include <structmember.h>
25244 __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *closure)
25246 if (unlikely(op->func_doc == NULL)) {
25247 if (op->func.m_ml->ml_doc) {
25248 #if PY_MAJOR_VERSION >= 3
25249 op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
25251 op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
25253 if (unlikely(op->func_doc == NULL))
25256 Py_INCREF(Py_None);
25260 Py_INCREF(op->func_doc);
25261 return op->func_doc;
25264 __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED
void *context)
25266 PyObject *tmp = op->func_doc;
25267 if (value == NULL) {
25271 op->func_doc = value;
25276 __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
25278 if (unlikely(op->func_name == NULL)) {
25279 #if PY_MAJOR_VERSION >= 3
25280 op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
25282 op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
25284 if (unlikely(op->func_name == NULL))
25287 Py_INCREF(op->func_name);
25288 return op->func_name;
25291 __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED
void *context)
25294 #if PY_MAJOR_VERSION >= 3
25295 if (unlikely(value == NULL || !PyUnicode_Check(value)))
25297 if (unlikely(value == NULL || !PyString_Check(value)))
25300 PyErr_SetString(PyExc_TypeError,
25301 "__name__ must be set to a string object");
25304 tmp = op->func_name;
25306 op->func_name = value;
25311 __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
25313 Py_INCREF(op->func_qualname);
25314 return op->func_qualname;
25317 __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED
void *context)
25320 #if PY_MAJOR_VERSION >= 3
25321 if (unlikely(value == NULL || !PyUnicode_Check(value)))
25323 if (unlikely(value == NULL || !PyString_Check(value)))
25326 PyErr_SetString(PyExc_TypeError,
25327 "__qualname__ must be set to a string object");
25330 tmp = op->func_qualname;
25332 op->func_qualname = value;
25337 __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED
void *closure)
25340 self = m->func_closure;
25347 __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
25349 if (unlikely(op->func_dict == NULL)) {
25350 op->func_dict = PyDict_New();
25351 if (unlikely(op->func_dict == NULL))
25354 Py_INCREF(op->func_dict);
25355 return op->func_dict;
25358 __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED
void *context)
25361 if (unlikely(value == NULL)) {
25362 PyErr_SetString(PyExc_TypeError,
25363 "function's dictionary may not be deleted");
25366 if (unlikely(!PyDict_Check(value))) {
25367 PyErr_SetString(PyExc_TypeError,
25368 "setting function's dictionary to a non-dict");
25371 tmp = op->func_dict;
25373 op->func_dict = value;
25378 __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
25380 Py_INCREF(op->func_globals);
25381 return op->func_globals;
25384 __Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
25386 Py_INCREF(Py_None);
25390 __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
25392 PyObject* result = (op->func_code) ? op->func_code : Py_None;
25397 __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
25399 PyObject *res = op->defaults_getter((PyObject *) op);
25400 if (unlikely(!res))
25402 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
25403 op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
25404 Py_INCREF(op->defaults_tuple);
25405 op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
25406 Py_INCREF(op->defaults_kwdict);
25408 op->defaults_tuple = PySequence_ITEM(res, 0);
25409 if (unlikely(!op->defaults_tuple)) result = -1;
25411 op->defaults_kwdict = PySequence_ITEM(res, 1);
25412 if (unlikely(!op->defaults_kwdict)) result = -1;
25419 __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED
void *context) {
25423 }
else if (value != Py_None && !PyTuple_Check(value)) {
25424 PyErr_SetString(PyExc_TypeError,
25425 "__defaults__ must be set to a tuple object");
25429 tmp = op->defaults_tuple;
25430 op->defaults_tuple = value;
25435 __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context) {
25436 PyObject* result = op->defaults_tuple;
25437 if (unlikely(!result)) {
25438 if (op->defaults_getter) {
25439 if (__Pyx_CyFunction_init_defaults(op) < 0)
return NULL;
25440 result = op->defaults_tuple;
25449 __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED
void *context) {
25453 }
else if (value != Py_None && !PyDict_Check(value)) {
25454 PyErr_SetString(PyExc_TypeError,
25455 "__kwdefaults__ must be set to a dict object");
25459 tmp = op->defaults_kwdict;
25460 op->defaults_kwdict = value;
25465 __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context) {
25466 PyObject* result = op->defaults_kwdict;
25467 if (unlikely(!result)) {
25468 if (op->defaults_getter) {
25469 if (__Pyx_CyFunction_init_defaults(op) < 0)
return NULL;
25470 result = op->defaults_kwdict;
25479 __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED
void *context) {
25481 if (!value || value == Py_None) {
25483 }
else if (!PyDict_Check(value)) {
25484 PyErr_SetString(PyExc_TypeError,
25485 "__annotations__ must be set to a dict object");
25489 tmp = op->func_annotations;
25490 op->func_annotations = value;
25495 __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context) {
25496 PyObject* result = op->func_annotations;
25497 if (unlikely(!result)) {
25498 result = PyDict_New();
25499 if (unlikely(!result))
return NULL;
25500 op->func_annotations = result;
25505 static PyGetSetDef __pyx_CyFunction_getsets[] = {
25506 {(
char *)
"func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
25507 {(
char *)
"__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
25508 {(
char *)
"func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
25509 {(
char *)
"__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
25510 {(
char *)
"__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
25511 {(
char *)
"__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
25512 {(
char *)
"func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
25513 {(
char *)
"__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
25514 {(
char *)
"func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
25515 {(
char *)
"__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
25516 {(
char *)
"func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
25517 {(
char *)
"__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
25518 {(
char *)
"func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
25519 {(
char *)
"__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
25520 {(
char *)
"func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
25521 {(
char *)
"__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
25522 {(
char *)
"__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
25523 {(
char *)
"__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
25526 static PyMemberDef __pyx_CyFunction_members[] = {
25527 {(
char *)
"__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0},
25531 __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
25533 #if PY_MAJOR_VERSION >= 3
25534 return PyUnicode_FromString(m->func.m_ml->ml_name);
25536 return PyString_FromString(m->func.m_ml->ml_name);
25539 static PyMethodDef __pyx_CyFunction_methods[] = {
25540 {
"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
25543 #if PY_VERSION_HEX < 0x030500A0
25544 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
25546 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
25548 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml,
int flags, PyObject* qualname,
25549 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
25550 if (unlikely(op == NULL))
25553 __Pyx_CyFunction_weakreflist(op) = NULL;
25554 op->func.m_ml = ml;
25555 op->func.m_self = (PyObject *) op;
25556 Py_XINCREF(closure);
25557 op->func_closure = closure;
25558 Py_XINCREF(module);
25559 op->func.m_module = module;
25560 op->func_dict = NULL;
25561 op->func_name = NULL;
25562 Py_INCREF(qualname);
25563 op->func_qualname = qualname;
25564 op->func_doc = NULL;
25565 op->func_classobj = NULL;
25566 op->func_globals = globals;
25567 Py_INCREF(op->func_globals);
25569 op->func_code = code;
25570 op->defaults_pyobjects = 0;
25571 op->defaults_size = 0;
25572 op->defaults = NULL;
25573 op->defaults_tuple = NULL;
25574 op->defaults_kwdict = NULL;
25575 op->defaults_getter = NULL;
25576 op->func_annotations = NULL;
25577 return (PyObject *) op;
25580 __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
25582 Py_CLEAR(m->func_closure);
25583 Py_CLEAR(m->func.m_module);
25584 Py_CLEAR(m->func_dict);
25585 Py_CLEAR(m->func_name);
25586 Py_CLEAR(m->func_qualname);
25587 Py_CLEAR(m->func_doc);
25588 Py_CLEAR(m->func_globals);
25589 Py_CLEAR(m->func_code);
25590 Py_CLEAR(m->func_classobj);
25591 Py_CLEAR(m->defaults_tuple);
25592 Py_CLEAR(m->defaults_kwdict);
25593 Py_CLEAR(m->func_annotations);
25595 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
25597 for (i = 0; i < m->defaults_pyobjects; i++)
25598 Py_XDECREF(pydefaults[i]);
25599 PyObject_Free(m->defaults);
25600 m->defaults = NULL;
25604 static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
25606 if (__Pyx_CyFunction_weakreflist(m) != NULL)
25607 PyObject_ClearWeakRefs((PyObject *) m);
25608 __Pyx_CyFunction_clear(m);
25609 PyObject_GC_Del(m);
25611 static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
25613 PyObject_GC_UnTrack(m);
25614 __Pyx__CyFunction_dealloc(m);
25616 static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit,
void *arg)
25618 Py_VISIT(m->func_closure);
25619 Py_VISIT(m->func.m_module);
25620 Py_VISIT(m->func_dict);
25621 Py_VISIT(m->func_name);
25622 Py_VISIT(m->func_qualname);
25623 Py_VISIT(m->func_doc);
25624 Py_VISIT(m->func_globals);
25625 Py_VISIT(m->func_code);
25626 Py_VISIT(m->func_classobj);
25627 Py_VISIT(m->defaults_tuple);
25628 Py_VISIT(m->defaults_kwdict);
25630 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
25632 for (i = 0; i < m->defaults_pyobjects; i++)
25633 Py_VISIT(pydefaults[i]);
25637 static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
25639 #if PY_MAJOR_VERSION < 3
25640 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
25641 if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
25645 if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
25647 type = (PyObject *)(Py_TYPE(obj));
25648 return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
25650 if (obj == Py_None)
25653 return __Pyx_PyMethod_New(func, obj, type);
25656 __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
25658 #if PY_MAJOR_VERSION >= 3
25659 return PyUnicode_FromFormat(
"<cyfunction %U at %p>",
25660 op->func_qualname, (
void *)op);
25662 return PyString_FromFormat(
"<cyfunction %s at %p>",
25663 PyString_AsString(op->func_qualname), (
void *)op);
25666 static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *
self, PyObject *arg, PyObject *kw) {
25667 PyCFunctionObject*
f = (PyCFunctionObject*)func;
25668 PyCFunction meth =
f->m_ml->ml_meth;
25670 switch (
f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
25672 if (likely(kw == NULL || PyDict_Size(kw) == 0))
25673 return (*meth)(
self, arg);
25675 case METH_VARARGS | METH_KEYWORDS:
25676 return (*(PyCFunctionWithKeywords)(
void*)meth)(
self, arg, kw);
25678 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
25679 size = PyTuple_GET_SIZE(arg);
25680 if (likely(size == 0))
25681 return (*meth)(
self, NULL);
25682 PyErr_Format(PyExc_TypeError,
25683 "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T
"d given)",
25684 f->m_ml->ml_name, size);
25689 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
25690 size = PyTuple_GET_SIZE(arg);
25691 if (likely(size == 1)) {
25692 PyObject *result, *arg0;
25693 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
25694 arg0 = PyTuple_GET_ITEM(arg, 0);
25696 arg0 = PySequence_ITEM(arg, 0);
if (unlikely(!arg0))
return NULL;
25698 result = (*meth)(
self, arg0);
25699 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
25704 PyErr_Format(PyExc_TypeError,
25705 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T
"d given)",
25706 f->m_ml->ml_name, size);
25711 PyErr_SetString(PyExc_SystemError,
"Bad call flags in "
25712 "__Pyx_CyFunction_Call. METH_OLDARGS is no "
25713 "longer supported!");
25716 PyErr_Format(PyExc_TypeError,
"%.200s() takes no keyword arguments",
25720 static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
25721 return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
25723 static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
25725 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
25726 if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
25728 PyObject *new_args;
25730 argc = PyTuple_GET_SIZE(args);
25731 new_args = PyTuple_GetSlice(args, 1, argc);
25732 if (unlikely(!new_args))
25734 self = PyTuple_GetItem(args, 0);
25735 if (unlikely(!
self)) {
25736 Py_DECREF(new_args);
25739 result = __Pyx_CyFunction_CallMethod(func,
self, new_args, kw);
25740 Py_DECREF(new_args);
25742 result = __Pyx_CyFunction_Call(func, args, kw);
25746 static PyTypeObject __pyx_CyFunctionType_type = {
25747 PyVarObject_HEAD_INIT(0, 0)
25748 "cython_function_or_method",
25749 sizeof(__pyx_CyFunctionObject),
25751 (destructor) __Pyx_CyFunction_dealloc,
25755 #if PY_MAJOR_VERSION < 3
25760 (reprfunc) __Pyx_CyFunction_repr,
25765 __Pyx_CyFunction_CallAsMethod,
25770 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
25772 (traverseproc) __Pyx_CyFunction_traverse,
25773 (inquiry) __Pyx_CyFunction_clear,
25775 #
if PY_VERSION_HEX < 0x030500A0
25776 offsetof(__pyx_CyFunctionObject, func_weakreflist),
25778 offsetof(PyCFunctionObject, m_weakreflist),
25782 __pyx_CyFunction_methods,
25783 __pyx_CyFunction_members,
25784 __pyx_CyFunction_getsets,
25787 __Pyx_CyFunction_descr_get,
25789 offsetof(__pyx_CyFunctionObject, func_dict),
25802 #if PY_VERSION_HEX >= 0x030400a1
25805 #if PY_VERSION_HEX >= 0x030800b1
25808 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
25812 static int __pyx_CyFunction_init(
void) {
25813 __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
25814 if (unlikely(__pyx_CyFunctionType == NULL)) {
25819 static CYTHON_INLINE
void *__Pyx_CyFunction_InitDefaults(PyObject *func,
size_t size,
int pyobjects) {
25820 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
25821 m->defaults = PyObject_Malloc(size);
25822 if (unlikely(!m->defaults))
25823 return PyErr_NoMemory();
25824 memset(m->defaults, 0, size);
25825 m->defaults_pyobjects = pyobjects;
25826 m->defaults_size = size;
25827 return m->defaults;
25829 static CYTHON_INLINE
void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
25830 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
25831 m->defaults_tuple = tuple;
25834 static CYTHON_INLINE
void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
25835 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
25836 m->defaults_kwdict = dict;
25839 static CYTHON_INLINE
void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
25840 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
25841 m->func_annotations = dict;
25846 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
int flags, PyObject* qualname,
25847 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
25848 PyObject *op = __Pyx_CyFunction_Init(
25849 PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType),
25850 ml, flags, qualname, closure, module, globals, code
25853 PyObject_GC_Track(op);
25859 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
25860 PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
25863 PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
25865 PyObject *pargs = PyTuple_Pack(2, name, bases);
25866 if (unlikely(!pargs)) {
25870 ns = PyObject_Call(prep, pargs, mkw);
25874 if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
25884 if (unlikely(PyObject_SetItem(
ns, __pyx_n_s_module, modname) < 0))
goto bad;
25885 if (unlikely(PyObject_SetItem(
ns, __pyx_n_s_qualname, qualname) < 0))
goto bad;
25886 if (unlikely(doc && PyObject_SetItem(
ns, __pyx_n_s_doc, doc) < 0))
goto bad;
25892 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
25893 PyObject *dict, PyObject *mkw,
25894 int calculate_metaclass,
int allow_py2_metaclass) {
25895 PyObject *result, *margs;
25896 PyObject *owned_metaclass = NULL;
25897 if (allow_py2_metaclass) {
25898 owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
25899 if (owned_metaclass) {
25900 metaclass = owned_metaclass;
25901 }
else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
25907 if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
25908 metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
25909 Py_XDECREF(owned_metaclass);
25910 if (unlikely(!metaclass))
25912 owned_metaclass = metaclass;
25914 margs = PyTuple_Pack(3, name, bases, dict);
25915 if (unlikely(!margs)) {
25918 result = PyObject_Call(metaclass, margs, mkw);
25921 Py_XDECREF(owned_metaclass);
25926 #ifndef CYTHON_CLINE_IN_TRACEBACK
25927 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate,
int c_line) {
25928 PyObject *use_cline;
25929 PyObject *ptype, *pvalue, *ptraceback;
25930 #if CYTHON_COMPILING_IN_CPYTHON
25931 PyObject **cython_runtime_dict;
25933 if (unlikely(!__pyx_cython_runtime)) {
25936 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
25937 #if CYTHON_COMPILING_IN_CPYTHON
25938 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
25939 if (likely(cython_runtime_dict)) {
25940 __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
25941 use_cline, *cython_runtime_dict,
25942 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
25946 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
25947 if (use_cline_obj) {
25948 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
25949 Py_DECREF(use_cline_obj);
25957 PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
25959 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
25962 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
25968 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries,
int count,
int code_line) {
25969 int start = 0, mid = 0, end = count - 1;
25970 if (end >= 0 && code_line > entries[end].code_line) {
25973 while (start < end) {
25974 mid = start + (end - start) / 2;
25975 if (code_line < entries[mid].code_line) {
25977 }
else if (code_line > entries[mid].code_line) {
25983 if (code_line <= entries[mid].code_line) {
25989 static PyCodeObject *__pyx_find_code_object(
int code_line) {
25990 PyCodeObject* code_object;
25992 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
25995 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
25996 if (unlikely(
pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[
pos].code_line != code_line)) {
25999 code_object = __pyx_code_cache.entries[
pos].code_object;
26000 Py_INCREF(code_object);
26001 return code_object;
26003 static void __pyx_insert_code_object(
int code_line, PyCodeObject* code_object) {
26005 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
26006 if (unlikely(!code_line)) {
26009 if (unlikely(!entries)) {
26010 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*
sizeof(__Pyx_CodeObjectCacheEntry));
26011 if (likely(entries)) {
26012 __pyx_code_cache.entries = entries;
26013 __pyx_code_cache.max_count = 64;
26014 __pyx_code_cache.count = 1;
26015 entries[0].code_line = code_line;
26016 entries[0].code_object = code_object;
26017 Py_INCREF(code_object);
26021 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
26022 if ((
pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[
pos].code_line == code_line)) {
26023 PyCodeObject* tmp = entries[
pos].code_object;
26024 entries[
pos].code_object = code_object;
26028 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
26029 int new_max = __pyx_code_cache.max_count + 64;
26030 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
26031 __pyx_code_cache.entries, ((
size_t)new_max) *
sizeof(__Pyx_CodeObjectCacheEntry));
26032 if (unlikely(!entries)) {
26035 __pyx_code_cache.entries = entries;
26036 __pyx_code_cache.max_count = new_max;
26038 for (i=__pyx_code_cache.count; i>
pos; i--) {
26039 entries[i] = entries[i-1];
26041 entries[
pos].code_line = code_line;
26042 entries[
pos].code_object = code_object;
26043 __pyx_code_cache.count++;
26044 Py_INCREF(code_object);
26048 #include "compile.h"
26049 #include "frameobject.h"
26050 #include "traceback.h"
26051 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
26052 const char *funcname,
int c_line,
26053 int py_line,
const char *filename) {
26054 PyCodeObject *py_code = 0;
26055 PyObject *py_srcfile = 0;
26056 PyObject *py_funcname = 0;
26057 #if PY_MAJOR_VERSION < 3
26058 py_srcfile = PyString_FromString(filename);
26060 py_srcfile = PyUnicode_FromString(filename);
26062 if (!py_srcfile)
goto bad;
26064 #if PY_MAJOR_VERSION < 3
26065 py_funcname = PyString_FromFormat(
"%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
26067 py_funcname = PyUnicode_FromFormat(
"%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
26071 #if PY_MAJOR_VERSION < 3
26072 py_funcname = PyString_FromString(funcname);
26074 py_funcname = PyUnicode_FromString(funcname);
26077 if (!py_funcname)
goto bad;
26078 py_code = __Pyx_PyCode_New(
26095 Py_DECREF(py_srcfile);
26096 Py_DECREF(py_funcname);
26099 Py_XDECREF(py_srcfile);
26100 Py_XDECREF(py_funcname);
26103 static void __Pyx_AddTraceback(
const char *funcname,
int c_line,
26104 int py_line,
const char *filename) {
26105 PyCodeObject *py_code = 0;
26106 PyFrameObject *py_frame = 0;
26107 PyThreadState *tstate = __Pyx_PyThreadState_Current;
26109 c_line = __Pyx_CLineForTraceback(tstate, c_line);
26111 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
26113 py_code = __Pyx_CreateCodeObjectForTraceback(
26114 funcname, c_line, py_line, filename);
26115 if (!py_code)
goto bad;
26116 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
26118 py_frame = PyFrame_New(
26124 if (!py_frame)
goto bad;
26125 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
26126 PyTraceBack_Here(py_frame);
26128 Py_XDECREF(py_code);
26129 Py_XDECREF(py_frame);
26132 #if PY_MAJOR_VERSION < 3
26133 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view,
int flags) {
26134 if (PyObject_CheckBuffer(obj))
return PyObject_GetBuffer(obj, view, flags);
26135 if (__Pyx_TypeCheck(obj, __pyx_array_type))
return __pyx_array_getbuffer(obj, view, flags);
26136 if (__Pyx_TypeCheck(obj, __pyx_memoryview_type))
return __pyx_memoryview_getbuffer(obj, view, flags);
26137 PyErr_Format(PyExc_TypeError,
"'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
26140 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
26141 PyObject *obj = view->obj;
26143 if (PyObject_CheckBuffer(obj)) {
26144 PyBuffer_Release(view);
26156 __pyx_memviewslice_is_contig(
const __Pyx_memviewslice mvs,
char order,
int ndim)
26158 int i, index, step, start;
26159 Py_ssize_t itemsize = mvs.memview->view.itemsize;
26160 if (order ==
'F') {
26167 for (i = 0; i < ndim; i++) {
26168 index = start + step * i;
26169 if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize)
26171 itemsize *= mvs.shape[index];
26178 __pyx_get_array_memory_extents(__Pyx_memviewslice *slice,
26179 void **out_start,
void **out_end,
26180 int ndim,
size_t itemsize)
26184 start = end = slice->data;
26185 for (i = 0; i < ndim; i++) {
26186 Py_ssize_t stride = slice->strides[i];
26187 Py_ssize_t extent = slice->shape[i];
26189 *out_start = *out_end = start;
26193 end += stride * (extent - 1);
26195 start += stride * (extent - 1);
26198 *out_start = start;
26199 *out_end = end + itemsize;
26202 __pyx_slices_overlap(__Pyx_memviewslice *slice1,
26203 __Pyx_memviewslice *slice2,
26204 int ndim,
size_t itemsize)
26206 void *start1, *end1, *start2, *end2;
26207 __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize);
26208 __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize);
26209 return (start1 < end2) && (start2 < end1);
26213 static CYTHON_INLINE PyObject *
26214 __pyx_capsule_create(
void *p, CYTHON_UNUSED
const char *sig)
26217 #if PY_VERSION_HEX >= 0x02070000
26218 cobj = PyCapsule_New(p, sig, NULL);
26220 cobj = PyCObject_FromVoidPtr(p, NULL);
26226 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
26227 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
26228 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
26229 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
26230 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
26232 func_type value = func_value;\
26233 if (sizeof(target_type) < sizeof(func_type)) {\
26234 if (unlikely(value != (func_type) (target_type) value)) {\
26235 func_type zero = 0;\
26236 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
26237 return (target_type) -1;\
26238 if (is_unsigned && unlikely(value < zero))\
26239 goto raise_neg_overflow;\
26241 goto raise_overflow;\
26244 return (target_type) value;\
26248 static CYTHON_INLINE
int __Pyx_Is_Little_Endian(
void)
26254 S.u32 = 0x01020304;
26255 return S.u8[0] == 4;
26259 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
26260 __Pyx_BufFmt_StackElem* stack,
26261 __Pyx_TypeInfo* type) {
26262 stack[0].field = &ctx->root;
26263 stack[0].parent_offset = 0;
26264 ctx->root.type = type;
26265 ctx->root.name =
"buffer dtype";
26266 ctx->root.offset = 0;
26268 ctx->head->field = &ctx->root;
26269 ctx->fmt_offset = 0;
26270 ctx->head->parent_offset = 0;
26271 ctx->new_packmode =
'@';
26272 ctx->enc_packmode =
'@';
26273 ctx->new_count = 1;
26274 ctx->enc_count = 0;
26276 ctx->is_complex = 0;
26277 ctx->is_valid_array = 0;
26278 ctx->struct_alignment = 0;
26279 while (type->typegroup ==
'S') {
26281 ctx->head->field = type->fields;
26282 ctx->head->parent_offset = 0;
26283 type = type->fields->type;
26286 static int __Pyx_BufFmt_ParseNumber(
const char** ts) {
26288 const char* t = *ts;
26289 if (*t < '0' || *t >
'9') {
26292 count = *t++ -
'0';
26293 while (*t >=
'0' && *t <=
'9') {
26295 count += *t++ -
'0';
26301 static int __Pyx_BufFmt_ExpectNumber(
const char **ts) {
26302 int number = __Pyx_BufFmt_ParseNumber(ts);
26304 PyErr_Format(PyExc_ValueError,\
26305 "Does not understand character buffer dtype format string ('%c')", **ts);
26308 static void __Pyx_BufFmt_RaiseUnexpectedChar(
char ch) {
26309 PyErr_Format(PyExc_ValueError,
26310 "Unexpected format string character: '%c'", ch);
26312 static const char* __Pyx_BufFmt_DescribeTypeChar(
char ch,
int is_complex) {
26314 case '?':
return "'bool'";
26315 case 'c':
return "'char'";
26316 case 'b':
return "'signed char'";
26317 case 'B':
return "'unsigned char'";
26318 case 'h':
return "'short'";
26319 case 'H':
return "'unsigned short'";
26320 case 'i':
return "'int'";
26321 case 'I':
return "'unsigned int'";
26322 case 'l':
return "'long'";
26323 case 'L':
return "'unsigned long'";
26324 case 'q':
return "'long long'";
26325 case 'Q':
return "'unsigned long long'";
26326 case 'f':
return (is_complex ?
"'complex float'" :
"'float'");
26327 case 'd':
return (is_complex ?
"'complex double'" :
"'double'");
26328 case 'g':
return (is_complex ?
"'complex long double'" :
"'long double'");
26329 case 'T':
return "a struct";
26330 case 'O':
return "Python object";
26331 case 'P':
return "a pointer";
26332 case 's':
case 'p':
return "a string";
26333 case 0:
return "end";
26334 default:
return "unparseable format string";
26337 static size_t __Pyx_BufFmt_TypeCharToStandardSize(
char ch,
int is_complex) {
26339 case '?':
case 'c':
case 'b':
case 'B':
case 's':
case 'p':
return 1;
26340 case 'h':
case 'H':
return 2;
26341 case 'i':
case 'I':
case 'l':
case 'L':
return 4;
26342 case 'q':
case 'Q':
return 8;
26343 case 'f':
return (is_complex ? 8 : 4);
26344 case 'd':
return (is_complex ? 16 : 8);
26346 PyErr_SetString(PyExc_ValueError,
"Python does not define a standard format string size for long double ('g')..");
26349 case 'O':
case 'P':
return sizeof(
void*);
26351 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
26355 static size_t __Pyx_BufFmt_TypeCharToNativeSize(
char ch,
int is_complex) {
26357 case '?':
case 'c':
case 'b':
case 'B':
case 's':
case 'p':
return 1;
26358 case 'h':
case 'H':
return sizeof(short);
26359 case 'i':
case 'I':
return sizeof(int);
26360 case 'l':
case 'L':
return sizeof(long);
26361 #ifdef HAVE_LONG_LONG
26362 case 'q':
case 'Q':
return sizeof(PY_LONG_LONG);
26364 case 'f':
return sizeof(float) * (is_complex ? 2 : 1);
26365 case 'd':
return sizeof(double) * (is_complex ? 2 : 1);
26366 case 'g':
return sizeof(
long double) * (is_complex ? 2 : 1);
26367 case 'O':
case 'P':
return sizeof(
void*);
26369 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
26374 typedef struct {
char c;
short x; } __Pyx_st_short;
26375 typedef struct {
char c;
int x; } __Pyx_st_int;
26376 typedef struct {
char c;
long x; } __Pyx_st_long;
26377 typedef struct {
char c;
float x; } __Pyx_st_float;
26378 typedef struct {
char c;
double x; } __Pyx_st_double;
26379 typedef struct {
char c;
long double x; } __Pyx_st_longdouble;
26380 typedef struct {
char c;
void *x; } __Pyx_st_void_p;
26381 #ifdef HAVE_LONG_LONG
26382 typedef struct {
char c; PY_LONG_LONG x; } __Pyx_st_longlong;
26384 static size_t __Pyx_BufFmt_TypeCharToAlignment(
char ch, CYTHON_UNUSED
int is_complex) {
26386 case '?':
case 'c':
case 'b':
case 'B':
case 's':
case 'p':
return 1;
26387 case 'h':
case 'H':
return sizeof(__Pyx_st_short) -
sizeof(
short);
26388 case 'i':
case 'I':
return sizeof(__Pyx_st_int) -
sizeof(
int);
26389 case 'l':
case 'L':
return sizeof(__Pyx_st_long) -
sizeof(
long);
26390 #ifdef HAVE_LONG_LONG
26391 case 'q':
case 'Q':
return sizeof(__Pyx_st_longlong) -
sizeof(PY_LONG_LONG);
26393 case 'f':
return sizeof(__Pyx_st_float) -
sizeof(
float);
26394 case 'd':
return sizeof(__Pyx_st_double) -
sizeof(
double);
26395 case 'g':
return sizeof(__Pyx_st_longdouble) -
sizeof(
long double);
26396 case 'P':
case 'O':
return sizeof(__Pyx_st_void_p) -
sizeof(
void*);
26398 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
26406 typedef struct {
short x;
char c; } __Pyx_pad_short;
26407 typedef struct {
int x;
char c; } __Pyx_pad_int;
26408 typedef struct {
long x;
char c; } __Pyx_pad_long;
26409 typedef struct {
float x;
char c; } __Pyx_pad_float;
26410 typedef struct {
double x;
char c; } __Pyx_pad_double;
26411 typedef struct {
long double x;
char c; } __Pyx_pad_longdouble;
26412 typedef struct {
void *x;
char c; } __Pyx_pad_void_p;
26413 #ifdef HAVE_LONG_LONG
26414 typedef struct { PY_LONG_LONG x;
char c; } __Pyx_pad_longlong;
26416 static size_t __Pyx_BufFmt_TypeCharToPadding(
char ch, CYTHON_UNUSED
int is_complex) {
26418 case '?':
case 'c':
case 'b':
case 'B':
case 's':
case 'p':
return 1;
26419 case 'h':
case 'H':
return sizeof(__Pyx_pad_short) -
sizeof(
short);
26420 case 'i':
case 'I':
return sizeof(__Pyx_pad_int) -
sizeof(
int);
26421 case 'l':
case 'L':
return sizeof(__Pyx_pad_long) -
sizeof(
long);
26422 #ifdef HAVE_LONG_LONG
26423 case 'q':
case 'Q':
return sizeof(__Pyx_pad_longlong) -
sizeof(PY_LONG_LONG);
26425 case 'f':
return sizeof(__Pyx_pad_float) -
sizeof(
float);
26426 case 'd':
return sizeof(__Pyx_pad_double) -
sizeof(
double);
26427 case 'g':
return sizeof(__Pyx_pad_longdouble) -
sizeof(
long double);
26428 case 'P':
case 'O':
return sizeof(__Pyx_pad_void_p) -
sizeof(
void*);
26430 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
26434 static char __Pyx_BufFmt_TypeCharToGroup(
char ch,
int is_complex) {
26438 case 'b':
case 'h':
case 'i':
26439 case 'l':
case 'q':
case 's':
case 'p':
26441 case '?':
case 'B':
case 'H':
case 'I':
case 'L':
case 'Q':
26443 case 'f':
case 'd':
case 'g':
26444 return (is_complex ?
'C' :
'R');
26450 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
26455 static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
26456 if (ctx->head == NULL || ctx->head->field == &ctx->root) {
26457 const char* expected;
26459 if (ctx->head == NULL) {
26463 expected = ctx->head->field->type->name;
26466 PyErr_Format(PyExc_ValueError,
26467 "Buffer dtype mismatch, expected %s%s%s but got %s",
26468 quote, expected, quote,
26469 __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
26471 __Pyx_StructField* field = ctx->head->field;
26472 __Pyx_StructField* parent = (ctx->head - 1)->field;
26473 PyErr_Format(PyExc_ValueError,
26474 "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
26475 field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
26476 parent->type->name, field->name);
26479 static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
26481 size_t size, offset, arraysize = 1;
26482 if (ctx->enc_type == 0)
return 0;
26483 if (ctx->head->field->type->arraysize[0]) {
26485 if (ctx->enc_type ==
's' || ctx->enc_type ==
'p') {
26486 ctx->is_valid_array = ctx->head->field->type->ndim == 1;
26488 if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
26489 PyErr_Format(PyExc_ValueError,
26490 "Expected a dimension of size %zu, got %zu",
26491 ctx->head->field->type->arraysize[0], ctx->enc_count);
26495 if (!ctx->is_valid_array) {
26496 PyErr_Format(PyExc_ValueError,
"Expected %d dimensions, got %d",
26497 ctx->head->field->type->ndim, ndim);
26500 for (i = 0; i < ctx->head->field->type->ndim; i++) {
26501 arraysize *= ctx->head->field->type->arraysize[i];
26503 ctx->is_valid_array = 0;
26504 ctx->enc_count = 1;
26506 group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
26508 __Pyx_StructField* field = ctx->head->field;
26509 __Pyx_TypeInfo* type = field->type;
26510 if (ctx->enc_packmode ==
'@' || ctx->enc_packmode ==
'^') {
26511 size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
26513 size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
26515 if (ctx->enc_packmode ==
'@') {
26516 size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
26517 size_t align_mod_offset;
26518 if (align_at == 0)
return -1;
26519 align_mod_offset = ctx->fmt_offset % align_at;
26520 if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
26521 if (ctx->struct_alignment == 0)
26522 ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
26525 if (type->size != size || type->typegroup != group) {
26526 if (type->typegroup ==
'C' && type->fields != NULL) {
26527 size_t parent_offset = ctx->head->parent_offset + field->offset;
26529 ctx->head->field = type->fields;
26530 ctx->head->parent_offset = parent_offset;
26533 if ((type->typegroup ==
'H' || group ==
'H') && type->size == size) {
26535 __Pyx_BufFmt_RaiseExpected(ctx);
26539 offset = ctx->head->parent_offset + field->offset;
26540 if (ctx->fmt_offset != offset) {
26541 PyErr_Format(PyExc_ValueError,
26542 "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T
"d but %" CYTHON_FORMAT_SSIZE_T
"d expected",
26543 (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
26546 ctx->fmt_offset += size;
26548 ctx->fmt_offset += (arraysize - 1) * size;
26551 if (field == &ctx->root) {
26553 if (ctx->enc_count != 0) {
26554 __Pyx_BufFmt_RaiseExpected(ctx);
26559 ctx->head->field = ++field;
26560 if (field->type == NULL) {
26562 field = ctx->head->field;
26564 }
else if (field->type->typegroup ==
'S') {
26565 size_t parent_offset = ctx->head->parent_offset + field->offset;
26566 if (field->type->fields->type == NULL)
continue;
26567 field = field->type->fields;
26569 ctx->head->field = field;
26570 ctx->head->parent_offset = parent_offset;
26576 }
while (ctx->enc_count);
26578 ctx->is_complex = 0;
26582 __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx,
const char** tsp)
26584 const char *ts = *tsp;
26585 int i = 0,
number, ndim;
26587 if (ctx->new_count != 1) {
26588 PyErr_SetString(PyExc_ValueError,
26589 "Cannot handle repeated arrays in format string");
26592 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
26593 ndim = ctx->head->field->type->ndim;
26594 while (*ts && *ts !=
')') {
26596 case ' ':
case '\f':
case '\r':
case '\n':
case '\t':
case '\v':
continue;
26599 number = __Pyx_BufFmt_ExpectNumber(&ts);
26600 if (
number == -1)
return NULL;
26601 if (i < ndim && (
size_t)
number != ctx->head->field->type->arraysize[i])
26602 return PyErr_Format(PyExc_ValueError,
26603 "Expected a dimension of size %zu, got %d",
26604 ctx->head->field->type->arraysize[i],
number);
26605 if (*ts !=
',' && *ts !=
')')
26606 return PyErr_Format(PyExc_ValueError,
26607 "Expected a comma in format string, got '%c'", *ts);
26608 if (*ts ==
',') ts++;
26612 return PyErr_Format(PyExc_ValueError,
"Expected %d dimension(s), got %d",
26613 ctx->head->field->type->ndim, i);
26615 PyErr_SetString(PyExc_ValueError,
26616 "Unexpected end of format string, expected ')'");
26619 ctx->is_valid_array = 1;
26620 ctx->new_count = 1;
26624 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx,
const char* ts) {
26629 if (ctx->enc_type != 0 && ctx->head == NULL) {
26630 __Pyx_BufFmt_RaiseExpected(ctx);
26633 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
26634 if (ctx->head != NULL) {
26635 __Pyx_BufFmt_RaiseExpected(ctx);
26645 if (!__Pyx_Is_Little_Endian()) {
26646 PyErr_SetString(PyExc_ValueError,
"Little-endian buffer not supported on big-endian compiler");
26649 ctx->new_packmode =
'=';
26654 if (__Pyx_Is_Little_Endian()) {
26655 PyErr_SetString(PyExc_ValueError,
"Big-endian buffer not supported on little-endian compiler");
26658 ctx->new_packmode =
'=';
26664 ctx->new_packmode = *ts++;
26668 const char* ts_after_sub;
26669 size_t i, struct_count = ctx->new_count;
26670 size_t struct_alignment = ctx->struct_alignment;
26671 ctx->new_count = 1;
26674 PyErr_SetString(PyExc_ValueError,
"Buffer acquisition: Expected '{' after 'T'");
26677 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
26679 ctx->enc_count = 0;
26680 ctx->struct_alignment = 0;
26683 for (i = 0; i != struct_count; ++i) {
26684 ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
26685 if (!ts_after_sub)
return NULL;
26688 if (struct_alignment) ctx->struct_alignment = struct_alignment;
26693 size_t alignment = ctx->struct_alignment;
26695 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
26697 if (alignment && ctx->fmt_offset % alignment) {
26698 ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
26703 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
26704 ctx->fmt_offset += ctx->new_count;
26705 ctx->new_count = 1;
26706 ctx->enc_count = 0;
26708 ctx->enc_packmode = ctx->new_packmode;
26714 if (*ts !=
'f' && *ts !=
'd' && *ts !=
'g') {
26715 __Pyx_BufFmt_RaiseUnexpectedChar(
'Z');
26718 CYTHON_FALLTHROUGH;
26719 case '?':
case 'c':
case 'b':
case 'B':
case 'h':
case 'H':
case 'i':
case 'I':
26720 case 'l':
case 'L':
case 'q':
case 'Q':
26721 case 'f':
case 'd':
case 'g':
26722 case 'O':
case 'p':
26723 if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) &&
26724 (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) {
26725 ctx->enc_count += ctx->new_count;
26726 ctx->new_count = 1;
26731 CYTHON_FALLTHROUGH;
26733 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
26734 ctx->enc_count = ctx->new_count;
26735 ctx->enc_packmode = ctx->new_packmode;
26736 ctx->enc_type = *ts;
26737 ctx->is_complex = got_Z;
26739 ctx->new_count = 1;
26744 while(*ts !=
':') ++ts;
26748 if (!__pyx_buffmt_parse_array(ctx, &ts))
return NULL;
26752 int number = __Pyx_BufFmt_ExpectNumber(&ts);
26753 if (
number == -1)
return NULL;
26754 ctx->new_count = (size_t)
number;
26762 __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
26769 if (a->size != b->size || a->typegroup != b->typegroup ||
26770 a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
26771 if (a->typegroup ==
'H' || b->typegroup ==
'H') {
26772 return a->size == b->size;
26778 for (i = 0; i < a->ndim; i++)
26779 if (a->arraysize[i] != b->arraysize[i])
26782 if (a->typegroup ==
'S') {
26783 if (a->flags != b->flags)
26785 if (a->fields || b->fields) {
26786 if (!(a->fields && b->fields))
26788 for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
26789 __Pyx_StructField *field_a = a->fields + i;
26790 __Pyx_StructField *field_b = b->fields + i;
26791 if (field_a->offset != field_b->offset ||
26792 !__pyx_typeinfo_cmp(field_a->type, field_b->type))
26795 return !a->fields[i].type && !b->fields[i].type;
26803 __pyx_check_strides(Py_buffer *buf,
int dim,
int ndim,
int spec)
26805 if (buf->shape[dim] <= 1)
26807 if (buf->strides) {
26808 if (spec & __Pyx_MEMVIEW_CONTIG) {
26809 if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
26810 if (unlikely(buf->strides[dim] !=
sizeof(
void *))) {
26811 PyErr_Format(PyExc_ValueError,
26812 "Buffer is not indirectly contiguous "
26813 "in dimension %d.", dim);
26816 }
else if (unlikely(buf->strides[dim] != buf->itemsize)) {
26817 PyErr_SetString(PyExc_ValueError,
26818 "Buffer and memoryview are not contiguous "
26819 "in the same dimension.");
26823 if (spec & __Pyx_MEMVIEW_FOLLOW) {
26824 Py_ssize_t stride = buf->strides[dim];
26827 if (unlikely(stride < buf->itemsize)) {
26828 PyErr_SetString(PyExc_ValueError,
26829 "Buffer and memoryview are not contiguous "
26830 "in the same dimension.");
26835 if (unlikely(spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1)) {
26836 PyErr_Format(PyExc_ValueError,
26837 "C-contiguous buffer is not contiguous in "
26838 "dimension %d", dim);
26840 }
else if (unlikely(spec & (__Pyx_MEMVIEW_PTR))) {
26841 PyErr_Format(PyExc_ValueError,
26842 "C-contiguous buffer is not indirect in "
26843 "dimension %d", dim);
26845 }
else if (unlikely(buf->suboffsets)) {
26846 PyErr_SetString(PyExc_ValueError,
26847 "Buffer exposes suboffsets but no strides");
26856 __pyx_check_suboffsets(Py_buffer *buf,
int dim, CYTHON_UNUSED
int ndim,
int spec)
26858 if (spec & __Pyx_MEMVIEW_DIRECT) {
26859 if (unlikely(buf->suboffsets && buf->suboffsets[dim] >= 0)) {
26860 PyErr_Format(PyExc_ValueError,
26861 "Buffer not compatible with direct access "
26862 "in dimension %d.", dim);
26866 if (spec & __Pyx_MEMVIEW_PTR) {
26867 if (unlikely(!buf->suboffsets || (buf->suboffsets[dim] < 0))) {
26868 PyErr_Format(PyExc_ValueError,
26869 "Buffer is not indirectly accessible "
26870 "in dimension %d.", dim);
26879 __pyx_verify_contig(Py_buffer *buf,
int ndim,
int c_or_f_flag)
26882 if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
26883 Py_ssize_t stride = 1;
26884 for (i = 0; i < ndim; i++) {
26885 if (unlikely(stride * buf->itemsize != buf->strides[i] && buf->shape[i] > 1)) {
26886 PyErr_SetString(PyExc_ValueError,
26887 "Buffer not fortran contiguous.");
26890 stride = stride * buf->shape[i];
26892 }
else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
26893 Py_ssize_t stride = 1;
26894 for (i = ndim - 1; i >- 1; i--) {
26895 if (unlikely(stride * buf->itemsize != buf->strides[i] && buf->shape[i] > 1)) {
26896 PyErr_SetString(PyExc_ValueError,
26897 "Buffer not C contiguous.");
26900 stride = stride * buf->shape[i];
26907 static int __Pyx_ValidateAndInit_memviewslice(
26912 __Pyx_TypeInfo *dtype,
26913 __Pyx_BufFmt_StackElem stack[],
26914 __Pyx_memviewslice *memviewslice,
26915 PyObject *original_obj)
26917 struct __pyx_memoryview_obj *memview, *new_memview;
26918 __Pyx_RefNannyDeclarations
26920 int i, spec = 0, retval = -1;
26921 __Pyx_BufFmt_Context ctx;
26922 int from_memoryview = __pyx_memoryview_check(original_obj);
26923 __Pyx_RefNannySetupContext(
"ValidateAndInit_memviewslice", 0);
26924 if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((
struct __pyx_memoryview_obj *)
26925 original_obj)->typeinfo)) {
26926 memview = (
struct __pyx_memoryview_obj *) original_obj;
26927 new_memview = NULL;
26929 memview = (
struct __pyx_memoryview_obj *) __pyx_memoryview_new(
26930 original_obj, buf_flags, 0, dtype);
26931 new_memview = memview;
26932 if (unlikely(!memview))
26935 buf = &memview->view;
26936 if (unlikely(buf->ndim != ndim)) {
26937 PyErr_Format(PyExc_ValueError,
26938 "Buffer has wrong number of dimensions (expected %d, got %d)",
26943 __Pyx_BufFmt_Init(&ctx, stack, dtype);
26944 if (unlikely(!__Pyx_BufFmt_CheckString(&ctx, buf->format)))
goto fail;
26946 if (unlikely((
unsigned) buf->itemsize != dtype->size)) {
26947 PyErr_Format(PyExc_ValueError,
26948 "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T
"u byte%s) "
26949 "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T
"u byte%s)",
26951 (buf->itemsize > 1) ?
"s" :
"",
26954 (dtype->size > 1) ?
"s" :
"");
26957 if (buf->len > 0) {
26958 for (i = 0; i < ndim; i++) {
26959 spec = axes_specs[i];
26960 if (unlikely(!__pyx_check_strides(buf, i, ndim, spec)))
26962 if (unlikely(!__pyx_check_suboffsets(buf, i, ndim, spec)))
26965 if (unlikely(buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag)))
26968 if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
26969 new_memview != NULL) == -1)) {
26975 Py_XDECREF(new_memview);
26978 __Pyx_RefNannyFinishContext();
26983 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(PyObject *obj,
int writable_flag) {
26984 __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
26985 __Pyx_BufFmt_StackElem stack[1];
26986 int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
26988 if (obj == Py_None) {
26989 result.memview = (
struct __pyx_memoryview_obj *) Py_None;
26992 retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
26993 PyBUF_RECORDS_RO | writable_flag, 1,
26994 &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, stack,
26996 if (unlikely(retcode == -1))
27000 result.memview = NULL;
27001 result.data = NULL;
27006 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int32_t(PyObject *obj,
int writable_flag) {
27007 __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
27008 __Pyx_BufFmt_StackElem stack[1];
27009 int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
27011 if (obj == Py_None) {
27012 result.memview = (
struct __pyx_memoryview_obj *) Py_None;
27015 retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
27016 PyBUF_RECORDS_RO | writable_flag, 1,
27017 &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, stack,
27019 if (unlikely(retcode == -1))
27023 result.memview = NULL;
27024 result.data = NULL;
27029 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_int32(npy_int32 value) {
27030 const npy_int32 neg_one = (npy_int32) ((npy_int32) 0 - (npy_int32) 1), const_zero = (npy_int32) 0;
27031 const int is_unsigned = neg_one > const_zero;
27033 if (
sizeof(npy_int32) <
sizeof(long)) {
27034 return PyInt_FromLong((
long) value);
27035 }
else if (
sizeof(npy_int32) <=
sizeof(
unsigned long)) {
27036 return PyLong_FromUnsignedLong((
unsigned long) value);
27037 #ifdef HAVE_LONG_LONG
27038 }
else if (
sizeof(npy_int32) <=
sizeof(
unsigned PY_LONG_LONG)) {
27039 return PyLong_FromUnsignedLongLong((
unsigned PY_LONG_LONG) value);
27043 if (
sizeof(npy_int32) <=
sizeof(
long)) {
27044 return PyInt_FromLong((
long) value);
27045 #ifdef HAVE_LONG_LONG
27046 }
else if (
sizeof(npy_int32) <=
sizeof(PY_LONG_LONG)) {
27047 return PyLong_FromLongLong((PY_LONG_LONG) value);
27052 int one = 1;
int little = (int)*(
unsigned char *)&one;
27053 unsigned char *bytes = (
unsigned char *)&value;
27054 return _PyLong_FromByteArray(bytes,
sizeof(npy_int32),
27055 little, !is_unsigned);
27060 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(
int value) {
27061 const int neg_one = (int) ((
int) 0 - (int) 1), const_zero = (int) 0;
27062 const int is_unsigned = neg_one > const_zero;
27064 if (
sizeof(
int) <
sizeof(long)) {
27065 return PyInt_FromLong((
long) value);
27066 }
else if (
sizeof(
int) <=
sizeof(
unsigned long)) {
27067 return PyLong_FromUnsignedLong((
unsigned long) value);
27068 #ifdef HAVE_LONG_LONG
27069 }
else if (
sizeof(
int) <=
sizeof(
unsigned PY_LONG_LONG)) {
27070 return PyLong_FromUnsignedLongLong((
unsigned PY_LONG_LONG) value);
27074 if (
sizeof(
int) <=
sizeof(
long)) {
27075 return PyInt_FromLong((
long) value);
27076 #ifdef HAVE_LONG_LONG
27077 }
else if (
sizeof(
int) <=
sizeof(PY_LONG_LONG)) {
27078 return PyLong_FromLongLong((PY_LONG_LONG) value);
27083 int one = 1;
int little = (int)*(
unsigned char *)&one;
27084 unsigned char *bytes = (
unsigned char *)&value;
27085 return _PyLong_FromByteArray(bytes,
sizeof(
int),
27086 little, !is_unsigned);
27091 #if CYTHON_CCOMPLEX
27093 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float x,
float y) {
27094 return ::std::complex< float >(x, y);
27097 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float x,
float y) {
27098 return x + y*(__pyx_t_float_complex)_Complex_I;
27102 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float x,
float y) {
27103 __pyx_t_float_complex
z;
27111 #if CYTHON_CCOMPLEX
27113 static CYTHON_INLINE
int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27114 return (a.real == b.real) && (a.imag == b.imag);
27116 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27117 __pyx_t_float_complex
z;
27118 z.real = a.real + b.real;
27119 z.imag = a.imag + b.imag;
27122 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27123 __pyx_t_float_complex
z;
27124 z.real = a.real - b.real;
27125 z.imag = a.imag - b.imag;
27128 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27129 __pyx_t_float_complex
z;
27130 z.real = a.real * b.real - a.imag * b.imag;
27131 z.imag = a.real * b.imag + a.imag * b.real;
27135 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27137 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
27138 }
else if (fabsf(b.real) >= fabsf(b.imag)) {
27139 if (b.real == 0 && b.imag == 0) {
27140 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
27142 float r = b.imag / b.real;
27143 float s = (float)(1.0) / (b.real + b.imag *
r);
27144 return __pyx_t_float_complex_from_parts(
27145 (a.real + a.imag *
r) *
s, (a.imag - a.real *
r) *
s);
27148 float r = b.real / b.imag;
27149 float s = (float)(1.0) / (b.imag + b.real *
r);
27150 return __pyx_t_float_complex_from_parts(
27151 (a.real *
r + a.imag) *
s, (a.imag *
r - a.real) *
s);
27155 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27157 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
27159 float denom = b.real * b.real + b.imag * b.imag;
27160 return __pyx_t_float_complex_from_parts(
27161 (a.real * b.real + a.imag * b.imag) / denom,
27162 (a.imag * b.real - a.real * b.imag) / denom);
27166 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
27167 __pyx_t_float_complex
z;
27172 static CYTHON_INLINE
int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
27173 return (a.real == 0) && (a.imag == 0);
27175 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
27176 __pyx_t_float_complex
z;
27182 static CYTHON_INLINE
float __Pyx_c_abs_float(__pyx_t_float_complex
z) {
27183 #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
27184 return sqrtf(
z.real*
z.real +
z.imag*
z.imag);
27186 return hypotf(
z.real,
z.imag);
27189 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27190 __pyx_t_float_complex
z;
27191 float r, lnr, theta, z_r, z_theta;
27192 if (b.imag == 0 && b.real == (
int)b.real) {
27194 float denom = a.real * a.real + a.imag * a.imag;
27195 a.real = a.real / denom;
27196 a.imag = -a.imag / denom;
27199 switch ((
int)b.real) {
27207 return __Pyx_c_prod_float(a, a);
27209 z = __Pyx_c_prod_float(a, a);
27210 return __Pyx_c_prod_float(
z, a);
27212 z = __Pyx_c_prod_float(a, a);
27213 return __Pyx_c_prod_float(
z,
z);
27219 }
else if (b.imag == 0) {
27220 z.real = powf(a.real, b.real);
27223 }
else if (a.real > 0) {
27228 theta = atan2f(0.0, -1.0);
27231 r = __Pyx_c_abs_float(a);
27232 theta = atan2f(a.imag, a.real);
27235 z_r = expf(lnr * b.real - theta * b.imag);
27236 z_theta = theta * b.real + lnr * b.imag;
27237 z.real = z_r * cosf(z_theta);
27238 z.imag = z_r * sinf(z_theta);
27245 #if CYTHON_CCOMPLEX
27247 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double x,
double y) {
27248 return ::std::complex< double >(x, y);
27251 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double x,
double y) {
27252 return x + y*(__pyx_t_double_complex)_Complex_I;
27256 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double x,
double y) {
27257 __pyx_t_double_complex
z;
27265 #if CYTHON_CCOMPLEX
27267 static CYTHON_INLINE
int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27268 return (a.real == b.real) && (a.imag == b.imag);
27270 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27271 __pyx_t_double_complex
z;
27272 z.real = a.real + b.real;
27273 z.imag = a.imag + b.imag;
27276 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27277 __pyx_t_double_complex
z;
27278 z.real = a.real - b.real;
27279 z.imag = a.imag - b.imag;
27282 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27283 __pyx_t_double_complex
z;
27284 z.real = a.real * b.real - a.imag * b.imag;
27285 z.imag = a.real * b.imag + a.imag * b.real;
27289 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27291 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
27292 }
else if (fabs(b.real) >= fabs(b.imag)) {
27293 if (b.real == 0 && b.imag == 0) {
27294 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
27296 double r = b.imag / b.real;
27297 double s = (double)(1.0) / (b.real + b.imag *
r);
27298 return __pyx_t_double_complex_from_parts(
27299 (a.real + a.imag *
r) *
s, (a.imag - a.real *
r) *
s);
27302 double r = b.real / b.imag;
27303 double s = (double)(1.0) / (b.imag + b.real *
r);
27304 return __pyx_t_double_complex_from_parts(
27305 (a.real *
r + a.imag) *
s, (a.imag *
r - a.real) *
s);
27309 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27311 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
27313 double denom = b.real * b.real + b.imag * b.imag;
27314 return __pyx_t_double_complex_from_parts(
27315 (a.real * b.real + a.imag * b.imag) / denom,
27316 (a.imag * b.real - a.real * b.imag) / denom);
27320 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
27321 __pyx_t_double_complex
z;
27326 static CYTHON_INLINE
int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
27327 return (a.real == 0) && (a.imag == 0);
27329 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
27330 __pyx_t_double_complex
z;
27336 static CYTHON_INLINE
double __Pyx_c_abs_double(__pyx_t_double_complex
z) {
27337 #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
27338 return sqrt(
z.real*
z.real +
z.imag*
z.imag);
27340 return hypot(
z.real,
z.imag);
27343 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27344 __pyx_t_double_complex
z;
27345 double r, lnr, theta, z_r, z_theta;
27346 if (b.imag == 0 && b.real == (
int)b.real) {
27348 double denom = a.real * a.real + a.imag * a.imag;
27349 a.real = a.real / denom;
27350 a.imag = -a.imag / denom;
27353 switch ((
int)b.real) {
27361 return __Pyx_c_prod_double(a, a);
27363 z = __Pyx_c_prod_double(a, a);
27364 return __Pyx_c_prod_double(
z, a);
27366 z = __Pyx_c_prod_double(a, a);
27367 return __Pyx_c_prod_double(
z,
z);
27373 }
else if (b.imag == 0) {
27374 z.real = pow(a.real, b.real);
27377 }
else if (a.real > 0) {
27382 theta = atan2(0.0, -1.0);
27385 r = __Pyx_c_abs_double(a);
27386 theta = atan2(a.imag, a.real);
27389 z_r = exp(lnr * b.real - theta * b.imag);
27390 z_theta = theta * b.real + lnr * b.imag;
27391 z.real = z_r * cos(z_theta);
27392 z.imag = z_r * sin(z_theta);
27399 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(
enum NPY_TYPES value) {
27400 const enum NPY_TYPES neg_one = (
enum NPY_TYPES) ((
enum NPY_TYPES) 0 - (
enum NPY_TYPES) 1), const_zero = (
enum NPY_TYPES) 0;
27401 const int is_unsigned = neg_one > const_zero;
27403 if (
sizeof(
enum NPY_TYPES) <
sizeof(long)) {
27404 return PyInt_FromLong((
long) value);
27405 }
else if (
sizeof(
enum NPY_TYPES) <=
sizeof(
unsigned long)) {
27406 return PyLong_FromUnsignedLong((
unsigned long) value);
27407 #ifdef HAVE_LONG_LONG
27408 }
else if (
sizeof(
enum NPY_TYPES) <=
sizeof(
unsigned PY_LONG_LONG)) {
27409 return PyLong_FromUnsignedLongLong((
unsigned PY_LONG_LONG) value);
27413 if (
sizeof(
enum NPY_TYPES) <=
sizeof(
long)) {
27414 return PyInt_FromLong((
long) value);
27415 #ifdef HAVE_LONG_LONG
27416 }
else if (
sizeof(
enum NPY_TYPES) <=
sizeof(PY_LONG_LONG)) {
27417 return PyLong_FromLongLong((PY_LONG_LONG) value);
27422 int one = 1;
int little = (int)*(
unsigned char *)&one;
27423 unsigned char *bytes = (
unsigned char *)&value;
27424 return _PyLong_FromByteArray(bytes,
sizeof(
enum NPY_TYPES),
27425 little, !is_unsigned);
27430 static __Pyx_memviewslice
27431 __pyx_memoryview_copy_new_contig(
const __Pyx_memviewslice *from_mvs,
27432 const char *mode,
int ndim,
27433 size_t sizeof_dtype,
int contig_flag,
27434 int dtype_is_object)
27436 __Pyx_RefNannyDeclarations
27438 __Pyx_memviewslice new_mvs = { 0, 0, { 0 }, { 0 }, { 0 } };
27439 struct __pyx_memoryview_obj *from_memview = from_mvs->memview;
27440 Py_buffer *buf = &from_memview->view;
27441 PyObject *shape_tuple = NULL;
27442 PyObject *temp_int = NULL;
27443 struct __pyx_array_obj *array_obj = NULL;
27444 struct __pyx_memoryview_obj *memview_obj = NULL;
27445 __Pyx_RefNannySetupContext(
"__pyx_memoryview_copy_new_contig", 0);
27446 for (i = 0; i < ndim; i++) {
27447 if (unlikely(from_mvs->suboffsets[i] >= 0)) {
27448 PyErr_Format(PyExc_ValueError,
"Cannot copy memoryview slice with "
27449 "indirect dimensions (axis %d)", i);
27453 shape_tuple = PyTuple_New(ndim);
27454 if (unlikely(!shape_tuple)) {
27457 __Pyx_GOTREF(shape_tuple);
27458 for(i = 0; i < ndim; i++) {
27459 temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
27460 if(unlikely(!temp_int)) {
27463 PyTuple_SET_ITEM(shape_tuple, i, temp_int);
27467 array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, (
char *) mode, NULL);
27468 if (unlikely(!array_obj)) {
27471 __Pyx_GOTREF(array_obj);
27472 memview_obj = (
struct __pyx_memoryview_obj *) __pyx_memoryview_new(
27473 (PyObject *) array_obj, contig_flag,
27475 from_mvs->memview->typeinfo);
27476 if (unlikely(!memview_obj))
27478 if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0))
27480 if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim,
27481 dtype_is_object) < 0))
27485 __Pyx_XDECREF(new_mvs.memview);
27486 new_mvs.memview = NULL;
27487 new_mvs.data = NULL;
27489 __Pyx_XDECREF(shape_tuple);
27490 __Pyx_XDECREF(temp_int);
27491 __Pyx_XDECREF(array_obj);
27492 __Pyx_RefNannyFinishContext();
27497 static CYTHON_INLINE
int __Pyx_PyInt_As_int(PyObject *x) {
27498 const int neg_one = (int) ((
int) 0 - (int) 1), const_zero = (int) 0;
27499 const int is_unsigned = neg_one > const_zero;
27500 #if PY_MAJOR_VERSION < 3
27501 if (likely(PyInt_Check(x))) {
27502 if (
sizeof(
int) <
sizeof(long)) {
27503 __PYX_VERIFY_RETURN_INT(
int,
long, PyInt_AS_LONG(x))
27505 long val = PyInt_AS_LONG(x);
27506 if (is_unsigned && unlikely(val < 0)) {
27507 goto raise_neg_overflow;
27513 if (likely(PyLong_Check(x))) {
27515 #if CYTHON_USE_PYLONG_INTERNALS
27516 const digit* digits = ((PyLongObject*)x)->ob_digit;
27517 switch (Py_SIZE(x)) {
27518 case 0:
return (
int) 0;
27519 case 1: __PYX_VERIFY_RETURN_INT(
int, digit, digits[0])
27521 if (8 *
sizeof(
int) > 1 * PyLong_SHIFT) {
27522 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27523 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27524 }
else if (8 *
sizeof(
int) >= 2 * PyLong_SHIFT) {
27525 return (
int) (((((int)digits[1]) << PyLong_SHIFT) | (
int)digits[0]));
27530 if (8 *
sizeof(
int) > 2 * PyLong_SHIFT) {
27531 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27532 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27533 }
else if (8 *
sizeof(
int) >= 3 * PyLong_SHIFT) {
27534 return (
int) (((((((int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
27539 if (8 *
sizeof(
int) > 3 * PyLong_SHIFT) {
27540 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27541 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27542 }
else if (8 *
sizeof(
int) >= 4 * PyLong_SHIFT) {
27543 return (
int) (((((((((int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (
int)digits[0]));
27549 #if CYTHON_COMPILING_IN_CPYTHON
27550 if (unlikely(Py_SIZE(x) < 0)) {
27551 goto raise_neg_overflow;
27555 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
27556 if (unlikely(result < 0))
27558 if (unlikely(result == 1))
27559 goto raise_neg_overflow;
27562 if (
sizeof(
int) <=
sizeof(
unsigned long)) {
27563 __PYX_VERIFY_RETURN_INT_EXC(
int,
unsigned long, PyLong_AsUnsignedLong(x))
27564 #ifdef HAVE_LONG_LONG
27565 }
else if (
sizeof(
int) <=
sizeof(
unsigned PY_LONG_LONG)) {
27566 __PYX_VERIFY_RETURN_INT_EXC(
int,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
27570 #if CYTHON_USE_PYLONG_INTERNALS
27571 const digit* digits = ((PyLongObject*)x)->ob_digit;
27572 switch (Py_SIZE(x)) {
27573 case 0:
return (
int) 0;
27574 case -1: __PYX_VERIFY_RETURN_INT(
int, sdigit, (sdigit) (-(sdigit)digits[0]))
27575 case 1: __PYX_VERIFY_RETURN_INT(
int, digit, +digits[0])
27577 if (8 *
sizeof(
int) - 1 > 1 * PyLong_SHIFT) {
27578 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27579 __PYX_VERIFY_RETURN_INT(
int,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27580 }
else if (8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT) {
27581 return (
int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
27586 if (8 *
sizeof(
int) > 1 * PyLong_SHIFT) {
27587 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27588 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27589 }
else if (8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT) {
27590 return (
int) ((((((int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
27595 if (8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT) {
27596 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27597 __PYX_VERIFY_RETURN_INT(
int,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27598 }
else if (8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT) {
27599 return (
int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
27604 if (8 *
sizeof(
int) > 2 * PyLong_SHIFT) {
27605 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27606 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27607 }
else if (8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT) {
27608 return (
int) ((((((((int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
27613 if (8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT) {
27614 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27615 __PYX_VERIFY_RETURN_INT(
int,
long, -(
long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27616 }
else if (8 *
sizeof(
int) - 1 > 4 * PyLong_SHIFT) {
27617 return (
int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
27622 if (8 *
sizeof(
int) > 3 * PyLong_SHIFT) {
27623 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27624 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27625 }
else if (8 *
sizeof(
int) - 1 > 4 * PyLong_SHIFT) {
27626 return (
int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
27632 if (
sizeof(
int) <=
sizeof(long)) {
27633 __PYX_VERIFY_RETURN_INT_EXC(
int,
long, PyLong_AsLong(x))
27634 #ifdef HAVE_LONG_LONG
27635 }
else if (
sizeof(
int) <=
sizeof(PY_LONG_LONG)) {
27636 __PYX_VERIFY_RETURN_INT_EXC(
int, PY_LONG_LONG, PyLong_AsLongLong(x))
27641 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
27642 PyErr_SetString(PyExc_RuntimeError,
27643 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
27646 PyObject *
v = __Pyx_PyNumber_IntOrLong(x);
27647 #if PY_MAJOR_VERSION < 3
27648 if (likely(
v) && !PyLong_Check(
v)) {
27650 v = PyNumber_Long(tmp);
27655 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
27656 unsigned char *bytes = (
unsigned char *)&val;
27657 int ret = _PyLong_AsByteArray((PyLongObject *)
v,
27658 bytes,
sizeof(val),
27659 is_little, !is_unsigned);
27669 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
27670 if (!tmp)
return (
int) -1;
27671 val = __Pyx_PyInt_As_int(tmp);
27676 PyErr_SetString(PyExc_OverflowError,
27677 "value too large to convert to int");
27679 raise_neg_overflow:
27680 PyErr_SetString(PyExc_OverflowError,
27681 "can't convert negative value to int");
27686 static CYTHON_INLINE npy_int32 __Pyx_PyInt_As_npy_int32(PyObject *x) {
27687 const npy_int32 neg_one = (npy_int32) ((npy_int32) 0 - (npy_int32) 1), const_zero = (npy_int32) 0;
27688 const int is_unsigned = neg_one > const_zero;
27689 #if PY_MAJOR_VERSION < 3
27690 if (likely(PyInt_Check(x))) {
27691 if (
sizeof(npy_int32) <
sizeof(long)) {
27692 __PYX_VERIFY_RETURN_INT(npy_int32,
long, PyInt_AS_LONG(x))
27694 long val = PyInt_AS_LONG(x);
27695 if (is_unsigned && unlikely(val < 0)) {
27696 goto raise_neg_overflow;
27698 return (npy_int32) val;
27702 if (likely(PyLong_Check(x))) {
27704 #if CYTHON_USE_PYLONG_INTERNALS
27705 const digit* digits = ((PyLongObject*)x)->ob_digit;
27706 switch (Py_SIZE(x)) {
27707 case 0:
return (npy_int32) 0;
27708 case 1: __PYX_VERIFY_RETURN_INT(npy_int32, digit, digits[0])
27710 if (8 *
sizeof(npy_int32) > 1 * PyLong_SHIFT) {
27711 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27712 __PYX_VERIFY_RETURN_INT(npy_int32,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27713 }
else if (8 *
sizeof(npy_int32) >= 2 * PyLong_SHIFT) {
27714 return (npy_int32) (((((npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0]));
27719 if (8 *
sizeof(npy_int32) > 2 * PyLong_SHIFT) {
27720 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27721 __PYX_VERIFY_RETURN_INT(npy_int32,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27722 }
else if (8 *
sizeof(npy_int32) >= 3 * PyLong_SHIFT) {
27723 return (npy_int32) (((((((npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0]));
27728 if (8 *
sizeof(npy_int32) > 3 * PyLong_SHIFT) {
27729 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27730 __PYX_VERIFY_RETURN_INT(npy_int32,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27731 }
else if (8 *
sizeof(npy_int32) >= 4 * PyLong_SHIFT) {
27732 return (npy_int32) (((((((((npy_int32)digits[3]) << PyLong_SHIFT) | (npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0]));
27738 #if CYTHON_COMPILING_IN_CPYTHON
27739 if (unlikely(Py_SIZE(x) < 0)) {
27740 goto raise_neg_overflow;
27744 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
27745 if (unlikely(result < 0))
27746 return (npy_int32) -1;
27747 if (unlikely(result == 1))
27748 goto raise_neg_overflow;
27751 if (
sizeof(npy_int32) <=
sizeof(
unsigned long)) {
27752 __PYX_VERIFY_RETURN_INT_EXC(npy_int32,
unsigned long, PyLong_AsUnsignedLong(x))
27753 #ifdef HAVE_LONG_LONG
27754 }
else if (
sizeof(npy_int32) <=
sizeof(
unsigned PY_LONG_LONG)) {
27755 __PYX_VERIFY_RETURN_INT_EXC(npy_int32,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
27759 #if CYTHON_USE_PYLONG_INTERNALS
27760 const digit* digits = ((PyLongObject*)x)->ob_digit;
27761 switch (Py_SIZE(x)) {
27762 case 0:
return (npy_int32) 0;
27763 case -1: __PYX_VERIFY_RETURN_INT(npy_int32, sdigit, (sdigit) (-(sdigit)digits[0]))
27764 case 1: __PYX_VERIFY_RETURN_INT(npy_int32, digit, +digits[0])
27766 if (8 *
sizeof(npy_int32) - 1 > 1 * PyLong_SHIFT) {
27767 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27768 __PYX_VERIFY_RETURN_INT(npy_int32,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27769 }
else if (8 *
sizeof(npy_int32) - 1 > 2 * PyLong_SHIFT) {
27770 return (npy_int32) (((npy_int32)-1)*(((((npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])));
27775 if (8 *
sizeof(npy_int32) > 1 * PyLong_SHIFT) {
27776 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27777 __PYX_VERIFY_RETURN_INT(npy_int32,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27778 }
else if (8 *
sizeof(npy_int32) - 1 > 2 * PyLong_SHIFT) {
27779 return (npy_int32) ((((((npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])));
27784 if (8 *
sizeof(npy_int32) - 1 > 2 * PyLong_SHIFT) {
27785 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27786 __PYX_VERIFY_RETURN_INT(npy_int32,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27787 }
else if (8 *
sizeof(npy_int32) - 1 > 3 * PyLong_SHIFT) {
27788 return (npy_int32) (((npy_int32)-1)*(((((((npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])));
27793 if (8 *
sizeof(npy_int32) > 2 * PyLong_SHIFT) {
27794 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27795 __PYX_VERIFY_RETURN_INT(npy_int32,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27796 }
else if (8 *
sizeof(npy_int32) - 1 > 3 * PyLong_SHIFT) {
27797 return (npy_int32) ((((((((npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])));
27802 if (8 *
sizeof(npy_int32) - 1 > 3 * PyLong_SHIFT) {
27803 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27804 __PYX_VERIFY_RETURN_INT(npy_int32,
long, -(
long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27805 }
else if (8 *
sizeof(npy_int32) - 1 > 4 * PyLong_SHIFT) {
27806 return (npy_int32) (((npy_int32)-1)*(((((((((npy_int32)digits[3]) << PyLong_SHIFT) | (npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])));
27811 if (8 *
sizeof(npy_int32) > 3 * PyLong_SHIFT) {
27812 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27813 __PYX_VERIFY_RETURN_INT(npy_int32,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27814 }
else if (8 *
sizeof(npy_int32) - 1 > 4 * PyLong_SHIFT) {
27815 return (npy_int32) ((((((((((npy_int32)digits[3]) << PyLong_SHIFT) | (npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])));
27821 if (
sizeof(npy_int32) <=
sizeof(long)) {
27822 __PYX_VERIFY_RETURN_INT_EXC(npy_int32,
long, PyLong_AsLong(x))
27823 #ifdef HAVE_LONG_LONG
27824 }
else if (
sizeof(npy_int32) <=
sizeof(PY_LONG_LONG)) {
27825 __PYX_VERIFY_RETURN_INT_EXC(npy_int32, PY_LONG_LONG, PyLong_AsLongLong(x))
27830 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
27831 PyErr_SetString(PyExc_RuntimeError,
27832 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
27835 PyObject *
v = __Pyx_PyNumber_IntOrLong(x);
27836 #if PY_MAJOR_VERSION < 3
27837 if (likely(
v) && !PyLong_Check(
v)) {
27839 v = PyNumber_Long(tmp);
27844 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
27845 unsigned char *bytes = (
unsigned char *)&val;
27846 int ret = _PyLong_AsByteArray((PyLongObject *)
v,
27847 bytes,
sizeof(val),
27848 is_little, !is_unsigned);
27854 return (npy_int32) -1;
27858 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
27859 if (!tmp)
return (npy_int32) -1;
27860 val = __Pyx_PyInt_As_npy_int32(tmp);
27865 PyErr_SetString(PyExc_OverflowError,
27866 "value too large to convert to npy_int32");
27867 return (npy_int32) -1;
27868 raise_neg_overflow:
27869 PyErr_SetString(PyExc_OverflowError,
27870 "can't convert negative value to npy_int32");
27871 return (npy_int32) -1;
27875 static CYTHON_INLINE
size_t __Pyx_PyInt_As_size_t(PyObject *x) {
27876 const size_t neg_one = (size_t) ((
size_t) 0 - (size_t) 1), const_zero = (size_t) 0;
27877 const int is_unsigned = neg_one > const_zero;
27878 #if PY_MAJOR_VERSION < 3
27879 if (likely(PyInt_Check(x))) {
27880 if (
sizeof(
size_t) <
sizeof(long)) {
27881 __PYX_VERIFY_RETURN_INT(
size_t,
long, PyInt_AS_LONG(x))
27883 long val = PyInt_AS_LONG(x);
27884 if (is_unsigned && unlikely(val < 0)) {
27885 goto raise_neg_overflow;
27887 return (
size_t) val;
27891 if (likely(PyLong_Check(x))) {
27893 #if CYTHON_USE_PYLONG_INTERNALS
27894 const digit* digits = ((PyLongObject*)x)->ob_digit;
27895 switch (Py_SIZE(x)) {
27896 case 0:
return (
size_t) 0;
27897 case 1: __PYX_VERIFY_RETURN_INT(
size_t, digit, digits[0])
27899 if (8 *
sizeof(
size_t) > 1 * PyLong_SHIFT) {
27900 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27901 __PYX_VERIFY_RETURN_INT(
size_t,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27902 }
else if (8 *
sizeof(
size_t) >= 2 * PyLong_SHIFT) {
27903 return (
size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
27908 if (8 *
sizeof(
size_t) > 2 * PyLong_SHIFT) {
27909 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27910 __PYX_VERIFY_RETURN_INT(
size_t,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27911 }
else if (8 *
sizeof(
size_t) >= 3 * PyLong_SHIFT) {
27912 return (
size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
27917 if (8 *
sizeof(
size_t) > 3 * PyLong_SHIFT) {
27918 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27919 __PYX_VERIFY_RETURN_INT(
size_t,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27920 }
else if (8 *
sizeof(
size_t) >= 4 * PyLong_SHIFT) {
27921 return (
size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (
size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
27927 #if CYTHON_COMPILING_IN_CPYTHON
27928 if (unlikely(Py_SIZE(x) < 0)) {
27929 goto raise_neg_overflow;
27933 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
27934 if (unlikely(result < 0))
27935 return (
size_t) -1;
27936 if (unlikely(result == 1))
27937 goto raise_neg_overflow;
27940 if (
sizeof(
size_t) <=
sizeof(
unsigned long)) {
27941 __PYX_VERIFY_RETURN_INT_EXC(
size_t,
unsigned long, PyLong_AsUnsignedLong(x))
27942 #ifdef HAVE_LONG_LONG
27943 }
else if (
sizeof(
size_t) <=
sizeof(
unsigned PY_LONG_LONG)) {
27944 __PYX_VERIFY_RETURN_INT_EXC(
size_t,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
27948 #if CYTHON_USE_PYLONG_INTERNALS
27949 const digit* digits = ((PyLongObject*)x)->ob_digit;
27950 switch (Py_SIZE(x)) {
27951 case 0:
return (
size_t) 0;
27952 case -1: __PYX_VERIFY_RETURN_INT(
size_t, sdigit, (sdigit) (-(sdigit)digits[0]))
27953 case 1: __PYX_VERIFY_RETURN_INT(
size_t, digit, +digits[0])
27955 if (8 *
sizeof(
size_t) - 1 > 1 * PyLong_SHIFT) {
27956 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27957 __PYX_VERIFY_RETURN_INT(
size_t,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27958 }
else if (8 *
sizeof(
size_t) - 1 > 2 * PyLong_SHIFT) {
27959 return (
size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0])));
27964 if (8 *
sizeof(
size_t) > 1 * PyLong_SHIFT) {
27965 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27966 __PYX_VERIFY_RETURN_INT(
size_t,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27967 }
else if (8 *
sizeof(
size_t) - 1 > 2 * PyLong_SHIFT) {
27968 return (
size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0])));
27973 if (8 *
sizeof(
size_t) - 1 > 2 * PyLong_SHIFT) {
27974 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27975 __PYX_VERIFY_RETURN_INT(
size_t,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27976 }
else if (8 *
sizeof(
size_t) - 1 > 3 * PyLong_SHIFT) {
27977 return (
size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
27982 if (8 *
sizeof(
size_t) > 2 * PyLong_SHIFT) {
27983 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27984 __PYX_VERIFY_RETURN_INT(
size_t,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27985 }
else if (8 *
sizeof(
size_t) - 1 > 3 * PyLong_SHIFT) {
27986 return (
size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
27991 if (8 *
sizeof(
size_t) - 1 > 3 * PyLong_SHIFT) {
27992 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27993 __PYX_VERIFY_RETURN_INT(
size_t,
long, -(
long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27994 }
else if (8 *
sizeof(
size_t) - 1 > 4 * PyLong_SHIFT) {
27995 return (
size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (
size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0])));
28000 if (8 *
sizeof(
size_t) > 3 * PyLong_SHIFT) {
28001 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
28002 __PYX_VERIFY_RETURN_INT(
size_t,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28003 }
else if (8 *
sizeof(
size_t) - 1 > 4 * PyLong_SHIFT) {
28004 return (
size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (
size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0])));
28010 if (
sizeof(
size_t) <=
sizeof(long)) {
28011 __PYX_VERIFY_RETURN_INT_EXC(
size_t,
long, PyLong_AsLong(x))
28012 #ifdef HAVE_LONG_LONG
28013 }
else if (
sizeof(
size_t) <=
sizeof(PY_LONG_LONG)) {
28014 __PYX_VERIFY_RETURN_INT_EXC(
size_t, PY_LONG_LONG, PyLong_AsLongLong(x))
28019 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
28020 PyErr_SetString(PyExc_RuntimeError,
28021 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
28024 PyObject *
v = __Pyx_PyNumber_IntOrLong(x);
28025 #if PY_MAJOR_VERSION < 3
28026 if (likely(
v) && !PyLong_Check(
v)) {
28028 v = PyNumber_Long(tmp);
28033 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
28034 unsigned char *bytes = (
unsigned char *)&val;
28035 int ret = _PyLong_AsByteArray((PyLongObject *)
v,
28036 bytes,
sizeof(val),
28037 is_little, !is_unsigned);
28043 return (
size_t) -1;
28047 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
28048 if (!tmp)
return (
size_t) -1;
28049 val = __Pyx_PyInt_As_size_t(tmp);
28054 PyErr_SetString(PyExc_OverflowError,
28055 "value too large to convert to size_t");
28056 return (
size_t) -1;
28057 raise_neg_overflow:
28058 PyErr_SetString(PyExc_OverflowError,
28059 "can't convert negative value to size_t");
28060 return (
size_t) -1;
28064 static CYTHON_INLINE
long __Pyx_PyInt_As_long(PyObject *x) {
28065 const long neg_one = (long) ((
long) 0 - (long) 1), const_zero = (long) 0;
28066 const int is_unsigned = neg_one > const_zero;
28067 #if PY_MAJOR_VERSION < 3
28068 if (likely(PyInt_Check(x))) {
28069 if (
sizeof(
long) <
sizeof(long)) {
28070 __PYX_VERIFY_RETURN_INT(
long,
long, PyInt_AS_LONG(x))
28072 long val = PyInt_AS_LONG(x);
28073 if (is_unsigned && unlikely(val < 0)) {
28074 goto raise_neg_overflow;
28080 if (likely(PyLong_Check(x))) {
28082 #if CYTHON_USE_PYLONG_INTERNALS
28083 const digit* digits = ((PyLongObject*)x)->ob_digit;
28084 switch (Py_SIZE(x)) {
28085 case 0:
return (
long) 0;
28086 case 1: __PYX_VERIFY_RETURN_INT(
long, digit, digits[0])
28088 if (8 *
sizeof(
long) > 1 * PyLong_SHIFT) {
28089 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
28090 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28091 }
else if (8 *
sizeof(
long) >= 2 * PyLong_SHIFT) {
28092 return (
long) (((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0]));
28097 if (8 *
sizeof(
long) > 2 * PyLong_SHIFT) {
28098 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
28099 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28100 }
else if (8 *
sizeof(
long) >= 3 * PyLong_SHIFT) {
28101 return (
long) (((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
28106 if (8 *
sizeof(
long) > 3 * PyLong_SHIFT) {
28107 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
28108 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28109 }
else if (8 *
sizeof(
long) >= 4 * PyLong_SHIFT) {
28110 return (
long) (((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0]));
28116 #if CYTHON_COMPILING_IN_CPYTHON
28117 if (unlikely(Py_SIZE(x) < 0)) {
28118 goto raise_neg_overflow;
28122 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
28123 if (unlikely(result < 0))
28125 if (unlikely(result == 1))
28126 goto raise_neg_overflow;
28129 if (
sizeof(
long) <=
sizeof(
unsigned long)) {
28130 __PYX_VERIFY_RETURN_INT_EXC(
long,
unsigned long, PyLong_AsUnsignedLong(x))
28131 #ifdef HAVE_LONG_LONG
28132 }
else if (
sizeof(
long) <=
sizeof(
unsigned PY_LONG_LONG)) {
28133 __PYX_VERIFY_RETURN_INT_EXC(
long,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
28137 #if CYTHON_USE_PYLONG_INTERNALS
28138 const digit* digits = ((PyLongObject*)x)->ob_digit;
28139 switch (Py_SIZE(x)) {
28140 case 0:
return (
long) 0;
28141 case -1: __PYX_VERIFY_RETURN_INT(
long, sdigit, (sdigit) (-(sdigit)digits[0]))
28142 case 1: __PYX_VERIFY_RETURN_INT(
long, digit, +digits[0])
28144 if (8 *
sizeof(
long) - 1 > 1 * PyLong_SHIFT) {
28145 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
28146 __PYX_VERIFY_RETURN_INT(
long,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28147 }
else if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
28148 return (
long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
28153 if (8 *
sizeof(
long) > 1 * PyLong_SHIFT) {
28154 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
28155 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28156 }
else if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
28157 return (
long) ((((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
28162 if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
28163 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
28164 __PYX_VERIFY_RETURN_INT(
long,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28165 }
else if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
28166 return (
long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
28171 if (8 *
sizeof(
long) > 2 * PyLong_SHIFT) {
28172 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
28173 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28174 }
else if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
28175 return (
long) ((((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
28180 if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
28181 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
28182 __PYX_VERIFY_RETURN_INT(
long,
long, -(
long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28183 }
else if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
28184 return (
long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
28189 if (8 *
sizeof(
long) > 3 * PyLong_SHIFT) {
28190 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
28191 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28192 }
else if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
28193 return (
long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
28199 if (
sizeof(
long) <=
sizeof(long)) {
28200 __PYX_VERIFY_RETURN_INT_EXC(
long,
long, PyLong_AsLong(x))
28201 #ifdef HAVE_LONG_LONG
28202 }
else if (
sizeof(
long) <=
sizeof(PY_LONG_LONG)) {
28203 __PYX_VERIFY_RETURN_INT_EXC(
long, PY_LONG_LONG, PyLong_AsLongLong(x))
28208 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
28209 PyErr_SetString(PyExc_RuntimeError,
28210 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
28213 PyObject *
v = __Pyx_PyNumber_IntOrLong(x);
28214 #if PY_MAJOR_VERSION < 3
28215 if (likely(
v) && !PyLong_Check(
v)) {
28217 v = PyNumber_Long(tmp);
28222 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
28223 unsigned char *bytes = (
unsigned char *)&val;
28224 int ret = _PyLong_AsByteArray((PyLongObject *)
v,
28225 bytes,
sizeof(val),
28226 is_little, !is_unsigned);
28236 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
28237 if (!tmp)
return (
long) -1;
28238 val = __Pyx_PyInt_As_long(tmp);
28243 PyErr_SetString(PyExc_OverflowError,
28244 "value too large to convert to long");
28246 raise_neg_overflow:
28247 PyErr_SetString(PyExc_OverflowError,
28248 "can't convert negative value to long");
28253 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(
long value) {
28254 const long neg_one = (long) ((
long) 0 - (long) 1), const_zero = (long) 0;
28255 const int is_unsigned = neg_one > const_zero;
28257 if (
sizeof(
long) <
sizeof(long)) {
28258 return PyInt_FromLong((
long) value);
28259 }
else if (
sizeof(
long) <=
sizeof(
unsigned long)) {
28260 return PyLong_FromUnsignedLong((
unsigned long) value);
28261 #ifdef HAVE_LONG_LONG
28262 }
else if (
sizeof(
long) <=
sizeof(
unsigned PY_LONG_LONG)) {
28263 return PyLong_FromUnsignedLongLong((
unsigned PY_LONG_LONG) value);
28267 if (
sizeof(
long) <=
sizeof(
long)) {
28268 return PyInt_FromLong((
long) value);
28269 #ifdef HAVE_LONG_LONG
28270 }
else if (
sizeof(
long) <=
sizeof(PY_LONG_LONG)) {
28271 return PyLong_FromLongLong((PY_LONG_LONG) value);
28276 int one = 1;
int little = (int)*(
unsigned char *)&one;
28277 unsigned char *bytes = (
unsigned char *)&value;
28278 return _PyLong_FromByteArray(bytes,
sizeof(
long),
28279 little, !is_unsigned);
28284 static CYTHON_INLINE
char __Pyx_PyInt_As_char(PyObject *x) {
28285 const char neg_one = (char) ((
char) 0 - (char) 1), const_zero = (char) 0;
28286 const int is_unsigned = neg_one > const_zero;
28287 #if PY_MAJOR_VERSION < 3
28288 if (likely(PyInt_Check(x))) {
28289 if (
sizeof(
char) <
sizeof(long)) {
28290 __PYX_VERIFY_RETURN_INT(
char,
long, PyInt_AS_LONG(x))
28292 long val = PyInt_AS_LONG(x);
28293 if (is_unsigned && unlikely(val < 0)) {
28294 goto raise_neg_overflow;
28300 if (likely(PyLong_Check(x))) {
28302 #if CYTHON_USE_PYLONG_INTERNALS
28303 const digit* digits = ((PyLongObject*)x)->ob_digit;
28304 switch (Py_SIZE(x)) {
28305 case 0:
return (
char) 0;
28306 case 1: __PYX_VERIFY_RETURN_INT(
char, digit, digits[0])
28308 if (8 *
sizeof(
char) > 1 * PyLong_SHIFT) {
28309 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
28310 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28311 }
else if (8 *
sizeof(
char) >= 2 * PyLong_SHIFT) {
28312 return (
char) (((((char)digits[1]) << PyLong_SHIFT) | (
char)digits[0]));
28317 if (8 *
sizeof(
char) > 2 * PyLong_SHIFT) {
28318 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
28319 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28320 }
else if (8 *
sizeof(
char) >= 3 * PyLong_SHIFT) {
28321 return (
char) (((((((char)digits[2]) << PyLong_SHIFT) | (
char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
28326 if (8 *
sizeof(
char) > 3 * PyLong_SHIFT) {
28327 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
28328 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28329 }
else if (8 *
sizeof(
char) >= 4 * PyLong_SHIFT) {
28330 return (
char) (((((((((char)digits[3]) << PyLong_SHIFT) | (
char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (
char)digits[0]));
28336 #if CYTHON_COMPILING_IN_CPYTHON
28337 if (unlikely(Py_SIZE(x) < 0)) {
28338 goto raise_neg_overflow;
28342 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
28343 if (unlikely(result < 0))
28345 if (unlikely(result == 1))
28346 goto raise_neg_overflow;
28349 if (
sizeof(
char) <=
sizeof(
unsigned long)) {
28350 __PYX_VERIFY_RETURN_INT_EXC(
char,
unsigned long, PyLong_AsUnsignedLong(x))
28351 #ifdef HAVE_LONG_LONG
28352 }
else if (
sizeof(
char) <=
sizeof(
unsigned PY_LONG_LONG)) {
28353 __PYX_VERIFY_RETURN_INT_EXC(
char,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
28357 #if CYTHON_USE_PYLONG_INTERNALS
28358 const digit* digits = ((PyLongObject*)x)->ob_digit;
28359 switch (Py_SIZE(x)) {
28360 case 0:
return (
char) 0;
28361 case -1: __PYX_VERIFY_RETURN_INT(
char, sdigit, (sdigit) (-(sdigit)digits[0]))
28362 case 1: __PYX_VERIFY_RETURN_INT(
char, digit, +digits[0])
28364 if (8 *
sizeof(
char) - 1 > 1 * PyLong_SHIFT) {
28365 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
28366 __PYX_VERIFY_RETURN_INT(
char,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28367 }
else if (8 *
sizeof(
char) - 1 > 2 * PyLong_SHIFT) {
28368 return (
char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (
char)digits[0])));
28373 if (8 *
sizeof(
char) > 1 * PyLong_SHIFT) {
28374 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
28375 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28376 }
else if (8 *
sizeof(
char) - 1 > 2 * PyLong_SHIFT) {
28377 return (
char) ((((((char)digits[1]) << PyLong_SHIFT) | (
char)digits[0])));
28382 if (8 *
sizeof(
char) - 1 > 2 * PyLong_SHIFT) {
28383 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
28384 __PYX_VERIFY_RETURN_INT(
char,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28385 }
else if (8 *
sizeof(
char) - 1 > 3 * PyLong_SHIFT) {
28386 return (
char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (
char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
28391 if (8 *
sizeof(
char) > 2 * PyLong_SHIFT) {
28392 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
28393 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28394 }
else if (8 *
sizeof(
char) - 1 > 3 * PyLong_SHIFT) {
28395 return (
char) ((((((((char)digits[2]) << PyLong_SHIFT) | (
char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
28400 if (8 *
sizeof(
char) - 1 > 3 * PyLong_SHIFT) {
28401 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
28402 __PYX_VERIFY_RETURN_INT(
char,
long, -(
long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28403 }
else if (8 *
sizeof(
char) - 1 > 4 * PyLong_SHIFT) {
28404 return (
char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (
char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (
char)digits[0])));
28409 if (8 *
sizeof(
char) > 3 * PyLong_SHIFT) {
28410 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
28411 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28412 }
else if (8 *
sizeof(
char) - 1 > 4 * PyLong_SHIFT) {
28413 return (
char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (
char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (
char)digits[0])));
28419 if (
sizeof(
char) <=
sizeof(long)) {
28420 __PYX_VERIFY_RETURN_INT_EXC(
char,
long, PyLong_AsLong(x))
28421 #ifdef HAVE_LONG_LONG
28422 }
else if (
sizeof(
char) <=
sizeof(PY_LONG_LONG)) {
28423 __PYX_VERIFY_RETURN_INT_EXC(
char, PY_LONG_LONG, PyLong_AsLongLong(x))
28428 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
28429 PyErr_SetString(PyExc_RuntimeError,
28430 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
28433 PyObject *
v = __Pyx_PyNumber_IntOrLong(x);
28434 #if PY_MAJOR_VERSION < 3
28435 if (likely(
v) && !PyLong_Check(
v)) {
28437 v = PyNumber_Long(tmp);
28442 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
28443 unsigned char *bytes = (
unsigned char *)&val;
28444 int ret = _PyLong_AsByteArray((PyLongObject *)
v,
28445 bytes,
sizeof(val),
28446 is_little, !is_unsigned);
28456 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
28457 if (!tmp)
return (
char) -1;
28458 val = __Pyx_PyInt_As_char(tmp);
28463 PyErr_SetString(PyExc_OverflowError,
28464 "value too large to convert to char");
28466 raise_neg_overflow:
28467 PyErr_SetString(PyExc_OverflowError,
28468 "can't convert negative value to char");
28473 static int __Pyx_check_binary_version(
void) {
28474 char ctversion[4], rtversion[4];
28475 PyOS_snprintf(ctversion, 4,
"%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
28476 PyOS_snprintf(rtversion, 4,
"%s", Py_GetVersion());
28477 if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
28479 PyOS_snprintf(message,
sizeof(message),
28480 "compiletime version %s of module '%.100s' "
28481 "does not match runtime version %s",
28482 ctversion, __Pyx_MODULE_NAME, rtversion);
28483 return PyErr_WarnEx(NULL, message, 1);
28489 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
28491 #if PY_MAJOR_VERSION < 3
28492 if (t->is_unicode) {
28493 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
28494 }
else if (t->intern) {
28495 *t->p = PyString_InternFromString(t->s);
28497 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
28500 if (t->is_unicode | t->is_str) {
28502 *t->p = PyUnicode_InternFromString(t->s);
28503 }
else if (t->encoding) {
28504 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
28506 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
28509 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
28514 if (PyObject_Hash(*t->p) == -1)
28521 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(
const char* c_str) {
28522 return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
28524 static CYTHON_INLINE
const char* __Pyx_PyObject_AsString(PyObject* o) {
28526 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
28528 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
28529 #if !CYTHON_PEP393_ENABLED
28530 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
28532 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
28533 if (!defenc)
return NULL;
28534 defenc_c = PyBytes_AS_STRING(defenc);
28535 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
28537 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
28539 for (
c = defenc_c;
c < end;
c++) {
28540 if ((
unsigned char) (*
c) >= 128) {
28541 PyUnicode_AsASCIIString(o);
28547 *length = PyBytes_GET_SIZE(defenc);
28551 static CYTHON_INLINE
const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
28552 if (unlikely(__Pyx_PyUnicode_READY(o) == -1))
return NULL;
28553 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
28554 if (likely(PyUnicode_IS_ASCII(o))) {
28555 *length = PyUnicode_GET_LENGTH(o);
28556 return PyUnicode_AsUTF8(o);
28558 PyUnicode_AsASCIIString(o);
28562 return PyUnicode_AsUTF8AndSize(o, length);
28567 static CYTHON_INLINE
const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
28568 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
28570 #
if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
28571 __Pyx_sys_getdefaultencoding_not_ascii &&
28573 PyUnicode_Check(o)) {
28574 return __Pyx_PyUnicode_AsStringAndSize(o, length);
28577 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
28578 if (PyByteArray_Check(o)) {
28579 *length = PyByteArray_GET_SIZE(o);
28580 return PyByteArray_AS_STRING(o);
28585 int r = PyBytes_AsStringAndSize(o, &result, length);
28586 if (unlikely(
r < 0)) {
28593 static CYTHON_INLINE
int __Pyx_PyObject_IsTrue(PyObject* x) {
28594 int is_true = x == Py_True;
28595 if (is_true | (x == Py_False) | (x == Py_None))
return is_true;
28596 else return PyObject_IsTrue(x);
28598 static CYTHON_INLINE
int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
28600 if (unlikely(!x))
return -1;
28601 retval = __Pyx_PyObject_IsTrue(x);
28605 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result,
const char* type_name) {
28606 #if PY_MAJOR_VERSION >= 3
28607 if (PyLong_Check(result)) {
28608 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
28609 "__int__ returned non-int (type %.200s). "
28610 "The ability to return an instance of a strict subclass of int "
28611 "is deprecated, and may be removed in a future version of Python.",
28612 Py_TYPE(result)->tp_name)) {
28619 PyErr_Format(PyExc_TypeError,
28620 "__%.4s__ returned non-%.4s (type %.200s)",
28621 type_name, type_name, Py_TYPE(result)->tp_name);
28625 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
28626 #if CYTHON_USE_TYPE_SLOTS
28627 PyNumberMethods *m;
28629 const char *name = NULL;
28630 PyObject *res = NULL;
28631 #if PY_MAJOR_VERSION < 3
28632 if (likely(PyInt_Check(x) || PyLong_Check(x)))
28634 if (likely(PyLong_Check(x)))
28636 return __Pyx_NewRef(x);
28637 #if CYTHON_USE_TYPE_SLOTS
28638 m = Py_TYPE(x)->tp_as_number;
28639 #if PY_MAJOR_VERSION < 3
28640 if (m && m->nb_int) {
28642 res = m->nb_int(x);
28644 else if (m && m->nb_long) {
28646 res = m->nb_long(x);
28649 if (likely(m && m->nb_int)) {
28651 res = m->nb_int(x);
28655 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
28656 res = PyNumber_Int(x);
28660 #if PY_MAJOR_VERSION < 3
28661 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
28663 if (unlikely(!PyLong_CheckExact(res))) {
28665 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
28668 else if (!PyErr_Occurred()) {
28669 PyErr_SetString(PyExc_TypeError,
28670 "an integer is required");
28674 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
28677 #if PY_MAJOR_VERSION < 3
28678 if (likely(PyInt_CheckExact(b))) {
28679 if (
sizeof(Py_ssize_t) >=
sizeof(
long))
28680 return PyInt_AS_LONG(b);
28682 return PyInt_AsSsize_t(b);
28685 if (likely(PyLong_CheckExact(b))) {
28686 #if CYTHON_USE_PYLONG_INTERNALS
28687 const digit* digits = ((PyLongObject*)b)->ob_digit;
28688 const Py_ssize_t size = Py_SIZE(b);
28689 if (likely(__Pyx_sst_abs(size) <= 1)) {
28690 ival = likely(size) ? digits[0] : 0;
28691 if (size == -1) ival = -ival;
28696 if (8 *
sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
28697 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
28701 if (8 *
sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
28702 return -(Py_ssize_t) (((((
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
28706 if (8 *
sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
28707 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
28711 if (8 *
sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
28712 return -(Py_ssize_t) (((((((
size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
28716 if (8 *
sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
28717 return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (
size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
28721 if (8 *
sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
28722 return -(Py_ssize_t) (((((((((
size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
28728 return PyLong_AsSsize_t(b);
28730 x = PyNumber_Index(b);
28732 ival = PyInt_AsSsize_t(x);
28736 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(
long b) {
28737 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
28739 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(
size_t ival) {
28740 return PyInt_FromSize_t(ival);